2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
2007-10-18 00:58:11 +08:00
|
|
|
|
2007-12-07 08:18:54 +08:00
|
|
|
@class Protocol;
|
2007-10-18 00:58:11 +08:00
|
|
|
|
2014-07-26 03:45:01 +08:00
|
|
|
@protocol fproto; // expected-note {{'fproto' declared here}}
|
2007-10-18 00:58:11 +08:00
|
|
|
|
|
|
|
@protocol p1
|
|
|
|
@end
|
|
|
|
|
|
|
|
@class cl;
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
Protocol *proto = @protocol(p1);
|
2018-08-18 06:18:08 +08:00
|
|
|
Protocol *fproto = @protocol(fproto); // expected-error {{@protocol is using a forward protocol declaration of 'fproto'}}
|
2007-10-18 00:58:11 +08:00
|
|
|
Protocol *pp = @protocol(i); // expected-error {{cannot find protocol declaration for 'i'}}
|
|
|
|
Protocol *p1p = @protocol(cl); // expected-error {{cannot find protocol declaration for 'cl'}}
|
|
|
|
}
|
|
|
|
|
2014-07-26 03:45:01 +08:00
|
|
|
// rdar://17768630
|
|
|
|
@protocol SuperProtocol; // expected-note {{'SuperProtocol' declared here}}
|
|
|
|
@protocol TestProtocol; // expected-note {{'TestProtocol' declared here}}
|
|
|
|
|
|
|
|
@interface I
|
|
|
|
- (int) conformsToProtocol : (Protocol *)protocl;
|
|
|
|
@end
|
|
|
|
|
|
|
|
int doesConform(id foo) {
|
2018-08-18 06:18:08 +08:00
|
|
|
return [foo conformsToProtocol:@protocol(TestProtocol)]; // expected-error {{@protocol is using a forward protocol declaration of 'TestProtocol'}}
|
2014-07-26 03:45:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int doesConformSuper(id foo) {
|
2018-08-18 06:18:08 +08:00
|
|
|
return [foo conformsToProtocol:@protocol(SuperProtocol)]; // expected-error {{@protocol is using a forward protocol declaration of 'SuperProtocol'}}
|
2014-07-26 03:45:01 +08:00
|
|
|
}
|