1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -x objective-c++ -fcxx-exceptions -fsyntax-only -Werror -verify -Wno-objc-root-class %s 2*f4a2713aSLionel Sambuc// expected-no-diagnostics 3*f4a2713aSLionel Sambuc// rdar://10387088 4*f4a2713aSLionel Sambuc 5*f4a2713aSLionel Sambuc@interface MyClass 6*f4a2713aSLionel Sambuc- (void)someMethod; 7*f4a2713aSLionel Sambuc@end 8*f4a2713aSLionel Sambuc 9*f4a2713aSLionel Sambucstruct BadReturn { 10*f4a2713aSLionel Sambuc BadReturn(MyClass * myObject); 11*f4a2713aSLionel Sambuc int bar(MyClass * myObject); 12*f4a2713aSLionel Sambuc void MemFunc(MyClass * myObject); 13*f4a2713aSLionel Sambuc int i; 14*f4a2713aSLionel Sambuc MyClass *CObj; 15*f4a2713aSLionel Sambuc}; 16*f4a2713aSLionel Sambuc 17*f4a2713aSLionel Sambuc@implementation MyClass 18*f4a2713aSLionel Sambuc- (void)someMethod { 19*f4a2713aSLionel Sambuc [self privateMethod]; // clang already does not warn here 20*f4a2713aSLionel Sambuc} 21*f4a2713aSLionel Sambuc 22*f4a2713aSLionel Sambucint BadReturn::bar(MyClass * myObject) { 23*f4a2713aSLionel Sambuc [myObject privateMethod]; 24*f4a2713aSLionel Sambuc return 0; 25*f4a2713aSLionel Sambuc} 26*f4a2713aSLionel Sambuc 27*f4a2713aSLionel SambucBadReturn::BadReturn(MyClass * myObject) try : CObj(myObject) { 28*f4a2713aSLionel Sambuc} catch(...) { 29*f4a2713aSLionel Sambuc try { 30*f4a2713aSLionel Sambuc [myObject privateMethod]; 31*f4a2713aSLionel Sambuc [myObject privateMethod1]; 32*f4a2713aSLionel Sambuc getMe = bar(myObject); 33*f4a2713aSLionel Sambuc [CObj privateMethod1]; 34*f4a2713aSLionel Sambuc } catch(int ei) { 35*f4a2713aSLionel Sambuc i = ei; 36*f4a2713aSLionel Sambuc } catch(...) { 37*f4a2713aSLionel Sambuc { 38*f4a2713aSLionel Sambuc i = 0; 39*f4a2713aSLionel Sambuc } 40*f4a2713aSLionel Sambuc } 41*f4a2713aSLionel Sambuc} 42*f4a2713aSLionel Sambuc 43*f4a2713aSLionel Sambucvoid BadReturn::MemFunc(MyClass * myObject) try { 44*f4a2713aSLionel Sambuc} catch(...) { 45*f4a2713aSLionel Sambuc try { 46*f4a2713aSLionel Sambuc [myObject privateMethod]; 47*f4a2713aSLionel Sambuc [myObject privateMethod1]; 48*f4a2713aSLionel Sambuc getMe = bar(myObject); 49*f4a2713aSLionel Sambuc [CObj privateMethod1]; 50*f4a2713aSLionel Sambuc } catch(int ei) { 51*f4a2713aSLionel Sambuc i = ei; 52*f4a2713aSLionel Sambuc } catch(...) { 53*f4a2713aSLionel Sambuc { 54*f4a2713aSLionel Sambuc i = 0; 55*f4a2713aSLionel Sambuc } 56*f4a2713aSLionel Sambuc } 57*f4a2713aSLionel Sambuc} 58*f4a2713aSLionel Sambuc 59*f4a2713aSLionel Sambuc- (void)privateMethod { } 60*f4a2713aSLionel Sambuc 61*f4a2713aSLionel Sambuc- (void)privateMethod1 { 62*f4a2713aSLionel Sambuc getMe = getMe+1; 63*f4a2713aSLionel Sambuc} 64*f4a2713aSLionel Sambuc 65*f4a2713aSLionel Sambucstatic int getMe; 66*f4a2713aSLionel Sambuc 67*f4a2713aSLionel Sambuc@end 68