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