| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 |
|
| 3 |
@protocol Foo; |
| 4 |
|
| 5 |
Class T; |
| 6 |
id<Foo> S; |
| 7 |
id R; |
| 8 |
void foo(void) { |
| 9 |
// Test assignment compatibility of Class and id. No warning should be |
| 10 |
// produced. |
| 11 |
// Class and id<foo> are compatible. |
| 12 |
S = T; // expected-error {{incompatible pointer types assigning to 'id<Foo>' from 'Class'}} |
| 13 |
T = S; // expected-error {{incompatible pointer types assigning to 'Class' from 'id<Foo>'}} |
| 14 |
R = T; T = R; |
| 15 |
R = S; S = R; |
| 16 |
} |
| 17 |
|
| 18 |
// Test attempt to redefine 'id' in an incompatible fashion. |
| 19 |
typedef int id; // expected-error {{typedef redefinition with different types ('int' vs 'id')}} |
| 20 |
id b; |
| 21 |
|
| 22 |
typedef double id; // expected-error {{typedef redefinition with different types ('double' vs 'id')}} |
| 23 |
|
| 24 |
typedef char *id; // expected-error {{typedef redefinition with different types ('char *' vs 'id')}} |
| 25 |
|
| 26 |
typedef union U{ int iu; } *id; // expected-error {{typedef redefinition with different types ('union U *' vs 'id')}} |
| 27 |
|
| 28 |
void test11356439(id o) { |
| 29 |
o->x; // expected-error {{member reference base type 'id' is not a structure or union}} |
| 30 |
} |