xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/protocol-expr-neg-1.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify %s
2f4a2713aSLionel Sambuc
3f4a2713aSLionel Sambuc@class Protocol;
4f4a2713aSLionel Sambuc
5*0a6a1f1dSLionel Sambuc@protocol fproto; // expected-note {{'fproto' declared here}}
6f4a2713aSLionel Sambuc
7f4a2713aSLionel Sambuc@protocol p1
8f4a2713aSLionel Sambuc@end
9f4a2713aSLionel Sambuc
10f4a2713aSLionel Sambuc@class cl;
11f4a2713aSLionel Sambuc
12f4a2713aSLionel Sambucint main()
13f4a2713aSLionel Sambuc{
14f4a2713aSLionel Sambuc	Protocol *proto = @protocol(p1);
15*0a6a1f1dSLionel Sambuc        Protocol *fproto = @protocol(fproto); // expected-warning {{@protocol is using a forward protocol declaration of fproto}}
16f4a2713aSLionel Sambuc	Protocol *pp = @protocol(i); // expected-error {{cannot find protocol declaration for 'i'}}
17f4a2713aSLionel Sambuc	Protocol *p1p = @protocol(cl); // expected-error {{cannot find protocol declaration for 'cl'}}
18f4a2713aSLionel Sambuc}
19f4a2713aSLionel Sambuc
20*0a6a1f1dSLionel Sambuc// rdar://17768630
21*0a6a1f1dSLionel Sambuc@protocol SuperProtocol; // expected-note {{'SuperProtocol' declared here}}
22*0a6a1f1dSLionel Sambuc@protocol TestProtocol; // expected-note {{'TestProtocol' declared here}}
23*0a6a1f1dSLionel Sambuc
24*0a6a1f1dSLionel Sambuc@interface I
25*0a6a1f1dSLionel Sambuc- (int) conformsToProtocol : (Protocol *)protocl;
26*0a6a1f1dSLionel Sambuc@end
27*0a6a1f1dSLionel Sambuc
28*0a6a1f1dSLionel Sambucint doesConform(id foo) {
29*0a6a1f1dSLionel Sambuc  return [foo conformsToProtocol:@protocol(TestProtocol)]; // expected-warning {{@protocol is using a forward protocol declaration of TestProtocol}}
30*0a6a1f1dSLionel Sambuc}
31*0a6a1f1dSLionel Sambuc
32*0a6a1f1dSLionel Sambucint doesConformSuper(id foo) {
33*0a6a1f1dSLionel Sambuc  return [foo conformsToProtocol:@protocol(SuperProtocol)]; // expected-warning {{@protocol is using a forward protocol declaration of SuperProtocol}}
34*0a6a1f1dSLionel Sambuc}
35