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