1*67e74705SXin Li// RUN: %clang_cc1 -fsyntax-only -verify -fobjc-exceptions -Wno-objc-root-class %s 2*67e74705SXin Li 3*67e74705SXin Li// rdar://6124613 4*67e74705SXin Livoid test1() { 5*67e74705SXin Li void *xyzzy = 0; 6*67e74705SXin Li void *p = @xyzzy; // expected-error {{unexpected '@' in program}} 7*67e74705SXin Li} 8*67e74705SXin Li 9*67e74705SXin Li// <rdar://problem/7495713> 10*67e74705SXin Li// This previously triggered a crash because the class has not been defined. 11*67e74705SXin Li@implementation RDar7495713 (rdar_7495713_cat) // expected-error{{cannot find interface declaration for 'RDar7495713'}} 12*67e74705SXin Li- (id) rdar_7495713 { 13*67e74705SXin Li __PRETTY_FUNCTION__; // expected-warning{{expression result unused}} 14*67e74705SXin Li} 15*67e74705SXin Li@end 16*67e74705SXin Li 17*67e74705SXin Li// <rdar://problem/7881045> 18*67e74705SXin Li// This previously triggered a crash because a ';' was expected after the @throw statement. 19*67e74705SXin Livoid foo() { 20*67e74705SXin Li @throw (id)0 // expected-error{{expected ';' after @throw}} 21*67e74705SXin Li} 22*67e74705SXin Li 23*67e74705SXin Li// <rdar://problem/10415026> 24*67e74705SXin Li@class NSView; 25*67e74705SXin Li@implementation IBFillView(IBFillViewIntegration) // expected-error {{cannot find interface declaration for 'IBFillView'}} 26*67e74705SXin Li- (NSView *)ibDesignableContentView { 27*67e74705SXin Li [Cake lie]; // expected-error {{undeclared}} 28*67e74705SXin Li return self; 29*67e74705SXin Li} 30*67e74705SXin Li@end 31*67e74705SXin Li 32*67e74705SXin Li@interface I 33*67e74705SXin Li@end 34*67e74705SXin Li@interface I2 35*67e74705SXin Li@end 36*67e74705SXin Li 37*67e74705SXin Li@implementation I // expected-note {{started here}} 38*67e74705SXin Li-(void) foo {} 39*67e74705SXin Li 40*67e74705SXin Li@implementation I2 // expected-error {{missing '@end'}} 41*67e74705SXin Li-(void) foo2 {} 42*67e74705SXin Li@end 43*67e74705SXin Li 44*67e74705SXin Li@end // expected-error {{'@end' must appear in an Objective-C context}} 45*67e74705SXin Li 46*67e74705SXin Li@class ForwardBase; 47*67e74705SXin Li@implementation SomeI : ForwardBase // expected-error {{cannot find interface declaration for 'ForwardBase', superclass of 'SomeI'}} \ 48*67e74705SXin Li // expected-warning {{cannot find interface declaration for 'SomeI'}} 49*67e74705SXin Li-(void)meth {} 50*67e74705SXin Li@end 51*67e74705SXin Li 52*67e74705SXin Li@interface I3 53*67e74705SXin Li__attribute__((unavailable)) @interface I4 @end // expected-error {{Objective-C declarations may only appear in global scope}} 54*67e74705SXin Li@end 55