annotate clang/test/SemaObjC/id.m @ 236:c4bab56944e8 llvm-original

LLVM 16
author kono
date Wed, 09 Nov 2022 17:45:10 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 @protocol Foo;
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 Class T;
anatofuz
parents:
diff changeset
6 id<Foo> S;
anatofuz
parents:
diff changeset
7 id R;
236
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
8 void foo(void) {
150
anatofuz
parents:
diff changeset
9 // Test assignment compatibility of Class and id. No warning should be
anatofuz
parents:
diff changeset
10 // produced.
anatofuz
parents:
diff changeset
11 // rdar://6770142 - Class and id<foo> are compatible.
anatofuz
parents:
diff changeset
12 S = T; // expected-warning {{incompatible pointer types assigning to 'id<Foo>' from 'Class'}}
anatofuz
parents:
diff changeset
13 T = S; // expected-warning {{incompatible pointer types assigning to 'Class' from 'id<Foo>'}}
anatofuz
parents:
diff changeset
14 R = T; T = R;
anatofuz
parents:
diff changeset
15 R = S; S = R;
anatofuz
parents:
diff changeset
16 }
anatofuz
parents:
diff changeset
17
anatofuz
parents:
diff changeset
18 // Test attempt to redefine 'id' in an incompatible fashion.
anatofuz
parents:
diff changeset
19 // rdar://11356439
anatofuz
parents:
diff changeset
20 typedef int id; // expected-error {{typedef redefinition with different types ('int' vs 'id')}}
anatofuz
parents:
diff changeset
21 id b;
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 typedef double id; // expected-error {{typedef redefinition with different types ('double' vs 'id')}}
anatofuz
parents:
diff changeset
24
anatofuz
parents:
diff changeset
25 typedef char *id; // expected-error {{typedef redefinition with different types ('char *' vs 'id')}}
anatofuz
parents:
diff changeset
26
anatofuz
parents:
diff changeset
27 typedef union U{ int iu; } *id; // expected-error {{typedef redefinition with different types ('union U *' vs 'id')}}
anatofuz
parents:
diff changeset
28
anatofuz
parents:
diff changeset
29 void test11356439(id o) {
anatofuz
parents:
diff changeset
30 o->x; // expected-error {{member reference base type 'id' is not a structure or union}}
anatofuz
parents:
diff changeset
31 }