1 // RUN: %clang_cc1 -emit-llvm-only %s 2 3 void p(const char*, ...); 4 5 @interface Root 6 +(int) maxValue; 7 -(int) conformsTo: (id) x; 8 @end 9 10 @protocol P0; 11 12 @protocol P1 13 +(void) classMethodReq0; 14 -(void) methodReq0; 15 @optional 16 +(void) classMethodOpt1; 17 -(void) methodOpt1; 18 @required 19 +(void) classMethodReq2; 20 -(void) methodReq2; 21 @end 22 23 @protocol P2 24 //@property(readwrite) int x; 25 @end 26 27 @protocol P3<P1, P2> 28 -(id <P1>) print0; 29 -(void) print1; 30 @end 31 32 void foo(const id a) { 33 void *p = @protocol(P3); 34 } 35 36 int main() { 37 Protocol *P0 = @protocol(P0); 38 Protocol *P1 = @protocol(P1); 39 Protocol *P2 = @protocol(P2); 40 Protocol *P3 = @protocol(P3); 41 42 #define Pbool(X) p(#X ": %s\n", X ? "yes" : "no"); 43 Pbool([P0 conformsTo: P1]); 44 Pbool([P1 conformsTo: P0]); 45 Pbool([P1 conformsTo: P2]); 46 Pbool([P2 conformsTo: P1]); 47 Pbool([P3 conformsTo: P1]); 48 Pbool([P1 conformsTo: P3]); 49 50 return 0; 51 } 52 53 // rdar://problem/7992749 54 typedef Root<P1> P1Object; 55 int test10() { 56 return [P1Object maxValue]; 57 } 58