blob: 206127a5ccef76aa2adf3785cc5ac2c6508da38b [file] [log] [blame]
Daniel Dunbar8fbe78f2009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Fariborz Jahanian1778f4b2009-01-16 19:58:32 +00002
Chris Lattner0d5640c2009-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.
Fariborz Jahaniand5bb8cb2010-03-19 18:06:10 +000012 S = T; // expected-warning {{incompatible pointer types assigning 'Class', expected 'id<Foo>'}}
13 T = S; // expected-warning {{incompatible pointer types assigning 'id<Foo>', expected 'Class'}}
Chris Lattner0d5640c2009-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 Naroff7cae42b2009-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 Jahanian1778f4b2009-01-16 19:58:32 +000020id b;
Chris Lattner0d5640c2009-04-12 09:02:39 +000021