1*67e74705SXin Li// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s 2*67e74705SXin Li 3*67e74705SXin Li@interface X1 4*67e74705SXin Li@end 5*67e74705SXin Li@implementation X1 // expected-note {{implementation started here}} 6*67e74705SXin Li@interface Y1 // expected-error {{missing '@end'}} 7*67e74705SXin Li@end 8*67e74705SXin Li@end // expected-error {{'@end' must appear in an Objective-C context}} 9*67e74705SXin Li 10*67e74705SXin Li@interface X2 11*67e74705SXin Li@end 12*67e74705SXin Li@implementation X2 // expected-note {{implementation started here}} 13*67e74705SXin Li@protocol Y2 // expected-error {{missing '@end'}} 14*67e74705SXin Li@end 15*67e74705SXin Li@end // expected-error {{'@end' must appear in an Objective-C context}} 16*67e74705SXin Li 17*67e74705SXin Li@interface X6 // expected-note {{class started here}} 18*67e74705SXin Li@interface X7 // expected-error {{missing '@end'}} 19*67e74705SXin Li@end 20*67e74705SXin Li@end // expected-error {{'@end' must appear in an Objective-C context}} 21*67e74705SXin Li 22*67e74705SXin Li@protocol P1 // expected-note {{protocol started here}} 23*67e74705SXin Li@interface P2 // expected-error {{missing '@end'}} 24*67e74705SXin Li@end 25*67e74705SXin Li@end // expected-error {{'@end' must appear in an Objective-C context}} 26*67e74705SXin Li 27*67e74705SXin Li@interface X4 // expected-note {{class started here}} 28*67e74705SXin Li@implementation X4 // expected-error {{missing '@end'}} 29*67e74705SXin Li@end 30*67e74705SXin Li@end // expected-error {{'@end' must appear in an Objective-C context}} 31*67e74705SXin Li 32*67e74705SXin Li@interface I 33*67e74705SXin Li@end 34*67e74705SXin Li@implementation I 35*67e74705SXin Li@protocol P; // forward declarations of protocols in @implementations is allowed 36*67e74705SXin Li@class C; // forward declarations of classes in @implementations is allowed 37*67e74705SXin Li- (C<P>*) MyMeth {} 38*67e74705SXin Li@end 39*67e74705SXin Li 40*67e74705SXin Li@interface I2 {} 41*67e74705SXin Li@protocol P2; // expected-error {{illegal interface qualifier}} 42*67e74705SXin Li@class C2; // expected-error {{illegal interface qualifier}} 43*67e74705SXin Li@end 44*67e74705SXin Li 45*67e74705SXin Li@interface I3 46*67e74705SXin Li@end 47*67e74705SXin Li@implementation I3 48*67e74705SXin Li- Meth {} 49*67e74705SXin Li+ Cls {} 50*67e74705SXin Li@protocol P3; 51*67e74705SXin Li@end 52