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