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