blob: 27b84dedf8e664ec628995517b536e3571e7d482 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Fariborz Jahanianc55a2402009-01-16 19:58:32 +00002
Chris Lattner2c4463f2009-04-12 09:02:39 +00003@protocol Foo;
4
5Class T;
6id<Foo> S;
7id R;
8void foo() {
9 // Test assignment compatibility of Class and id. No warning should be
10 // produced.
11 // rdar://6770142 - Class and id<foo> are compatible.
Douglas Gregord4eea832010-04-09 00:35:39 +000012 S = T; // expected-warning {{incompatible pointer types assigning to 'id<Foo>' from 'Class'}}
13 T = S; // expected-warning {{incompatible pointer types assigning to 'Class' from 'id<Foo>'}}
Chris Lattner2c4463f2009-04-12 09:02:39 +000014 R = T; T = R;
15 R = S; S = R;
16}
17
18// Test attempt to redefine 'id' in an incompatible fashion.
Steve Naroff14108da2009-07-10 23:34:53 +000019typedef int id; // FIXME: Decide how we want to deal with this (now that 'id' is more of a built-in type).
Fariborz Jahanianc55a2402009-01-16 19:58:32 +000020id b;
Chris Lattner2c4463f2009-04-12 09:02:39 +000021