1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -Wno-deprecated-declarations -verify %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuc@interface INTF1 4*f4a2713aSLionel Sambuc@required // expected-error {{directive may only be specified in protocols only}} 5*f4a2713aSLionel Sambuc- (int) FooBar; 6*f4a2713aSLionel Sambuc- (int) FooBar1; 7*f4a2713aSLionel Sambuc- (int) FooBar2; 8*f4a2713aSLionel Sambuc@optional // expected-error {{directive may only be specified in protocols only}} 9*f4a2713aSLionel Sambuc+ (int) C; 10*f4a2713aSLionel Sambuc 11*f4a2713aSLionel Sambuc- (int)I; 12*f4a2713aSLionel Sambuc@end 13*f4a2713aSLionel Sambuc 14*f4a2713aSLionel Sambuc@protocol p1,p2,p3; 15*f4a2713aSLionel Sambuc 16*f4a2713aSLionel Sambuc@protocol p1; 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambuc@protocol PROTO1 19*f4a2713aSLionel Sambuc@required 20*f4a2713aSLionel Sambuc- (int) FooBar; 21*f4a2713aSLionel Sambuc@optional 22*f4a2713aSLionel Sambuc- (void) MyMethod1; 23*f4a2713aSLionel Sambuc+ (int) S; 24*f4a2713aSLionel Sambuc@end 25*f4a2713aSLionel Sambuc 26*f4a2713aSLionel Sambuc 27*f4a2713aSLionel Sambuc@protocol PROTO2<p1> 28*f4a2713aSLionel Sambuc@end 29*f4a2713aSLionel Sambuc 30*f4a2713aSLionel Sambuc@protocol p1 @end 31*f4a2713aSLionel Sambuc 32*f4a2713aSLionel Sambuc@protocol PROTO<p1> // expected-note {{previous definition is here}} 33*f4a2713aSLionel Sambuc@end 34*f4a2713aSLionel Sambuc 35*f4a2713aSLionel Sambuc@protocol PROTO<p1> // expected-warning {{duplicate protocol definition of 'PROTO'}} 36*f4a2713aSLionel Sambuc@end 37*f4a2713aSLionel Sambuc 38*f4a2713aSLionel Sambuc@protocol PROTO3<p1, p1> 39*f4a2713aSLionel Sambuc@end 40*f4a2713aSLionel Sambuc 41*f4a2713aSLionel Sambuc@protocol p2 <p1> 42*f4a2713aSLionel Sambuc@end 43*f4a2713aSLionel Sambuc 44*f4a2713aSLionel Sambuc@protocol PROTO4 <p1, p2, PROTO, PROTO3, p3> 45*f4a2713aSLionel Sambuc@end 46*f4a2713aSLionel Sambuc 47*f4a2713aSLionel Sambuc 48*f4a2713aSLionel Sambuc// rdar://6771034 49*f4a2713aSLionel Sambuc@protocol XX; 50*f4a2713aSLionel Sambuc@protocol YY <XX> // Use of declaration of XX here should not cause a warning. 51*f4a2713aSLionel Sambuc- zz; 52*f4a2713aSLionel Sambuc@end 53*f4a2713aSLionel Sambuc 54*f4a2713aSLionel Sambuc 55*f4a2713aSLionel Sambuc// Detect circular dependencies. 56*f4a2713aSLionel Sambuc@protocol B; 57*f4a2713aSLionel Sambuc@protocol C < B > // expected-note{{previous definition is here}} 58*f4a2713aSLionel Sambuc@end 59*f4a2713aSLionel Sambuc@protocol A < C > 60*f4a2713aSLionel Sambuc@end 61*f4a2713aSLionel Sambuc@protocol B < A > // expected-error{{protocol has circular dependency}} 62*f4a2713aSLionel Sambuc@end 63*f4a2713aSLionel Sambuc 64*f4a2713aSLionel Sambuc@protocol P 65*f4a2713aSLionel Sambuc- (int)test:(int)param, ..; // expected-warning{{type specifier missing}} \ 66*f4a2713aSLionel Sambuc // expected-error{{expected ';' after method prototype}} 67*f4a2713aSLionel Sambuc@end 68