brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 9786aab Raw
34 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3@class Protocol;4 5@protocol fproto; // expected-note {{'fproto' declared here}}6 7@protocol p1 8@end9 10@class cl;11 12int main(void)13{14	Protocol *proto = @protocol(p1);15        Protocol *fproto = @protocol(fproto); // expected-error {{@protocol is using a forward protocol declaration of 'fproto'}}16	Protocol *pp = @protocol(i); // expected-error {{cannot find protocol declaration for 'i'}}17	Protocol *p1p = @protocol(cl); // expected-error {{cannot find protocol declaration for 'cl'}}18}19 20@protocol SuperProtocol; // expected-note {{'SuperProtocol' declared here}}21@protocol TestProtocol; // expected-note {{'TestProtocol' declared here}}22 23@interface I24- (int) conformsToProtocol : (Protocol *)protocl;25@end26 27int doesConform(id foo) {28  return [foo conformsToProtocol:@protocol(TestProtocol)]; // expected-error {{@protocol is using a forward protocol declaration of 'TestProtocol'}}29}30 31int doesConformSuper(id foo) {32  return [foo conformsToProtocol:@protocol(SuperProtocol)]; // expected-error {{@protocol is using a forward protocol declaration of 'SuperProtocol'}}33}34