1 /* Test assignments and comparisons between protocols (obscure case). */
2 /* Author: Nicola Pero <nicola@brainstorm.co.uk>. */
3 /* { dg-do compile } */
14 @protocol MyProtocolAB <MyProtocolA, MyProtocolB>
17 @protocol MyProtocolAC <MyProtocolA>
23 id<MyProtocolA> obj_a = nil;
24 id<MyProtocolB> obj_b = nil;
25 id<MyProtocolAB> obj_ab = nil;
26 id<MyProtocolAC> obj_ac = nil;
28 obj_a = obj_b; /* { dg-warning "does not conform" } */
29 obj_a = obj_ab; /* Ok */
30 obj_a = obj_ac; /* Ok */
32 obj_b = obj_a; /* { dg-warning "does not conform" } */
33 obj_b = obj_ab; /* Ok */
34 obj_b = obj_ac; /* { dg-warning "does not conform" } */
36 obj_ab = obj_a; /* { dg-warning "does not conform" } */
37 obj_ab = obj_b; /* { dg-warning "does not conform" } */
38 obj_ab = obj_ac; /* { dg-warning "does not conform" } */
40 obj_ac = obj_a; /* { dg-warning "does not conform" } */
41 obj_ac = obj_b; /* { dg-warning "does not conform" } */
42 obj_ac = obj_ab; /* { dg-warning "does not conform" } */
44 if (obj_a == obj_b) ; /* { dg-warning "lacks a cast" } */
45 if (obj_b == obj_a) ; /* { dg-warning "lacks a cast" } */
47 if (obj_a == obj_ab) ; /* Ok */
48 if (obj_ab == obj_a) ; /* Ok */ /* Spurious 2.95.4 warning here */
50 if (obj_a == obj_ac) ; /* Ok */
51 if (obj_ac == obj_a) ; /* Ok */ /* Spurious 2.95.4 warning here */
53 if (obj_b == obj_ab) ; /* Ok */
54 if (obj_ab == obj_b) ; /* Ok */ /* Spurious 2.95.4 warning here */
56 if (obj_b == obj_ac) ; /* { dg-warning "lacks a cast" } */
57 if (obj_ac == obj_b) ; /* { dg-warning "lacks a cast" } */
59 if (obj_ab == obj_ac) ; /* { dg-warning "lacks a cast" } */
60 if (obj_ac == obj_ab) ; /* { dg-warning "lacks a cast" } */