1 // RUN: %clang_cc1 -fobjc-arc -isystem %S/Inputs %s -DNO_USE
2 // RUN: %clang_cc1 -fobjc-arc -isystem %S/Inputs %s -verify
4 #include <arc-system-header.h>
7 void test(id op, void *cp) {
8 cp = test0(op); // expected-error {{'test0' is unavailable in ARC}}
9 cp = *test1(&op); // expected-error {{'test1' is unavailable in ARC}}
10 // expected-note@arc-system-header.h:1 {{inline function performs a conversion which is forbidden in ARC}}
11 // expected-note@arc-system-header.h:5 {{inline function performs a conversion which is forbidden in ARC}}
14 void test3(struct Test3 *p) {
15 p->field = 0; // expected-error {{'field' is unavailable in ARC}}
16 // expected-note@arc-system-header.h:14 {{declaration uses type that is ill-formed in ARC}}
19 void test4(Test4 *p) {
20 p->field1 = 0; // expected-error {{'field1' is unavailable in ARC}}
21 // expected-note@arc-system-header.h:19 {{declaration uses type that is ill-formed in ARC}}
25 void test5(struct Test5 *p) {
30 // This is actually okay to use if declared in a system header.
32 x = (id) kMagicConstant;
33 x = (id) (x ? kMagicConstant : kMagicConstant);
34 x = (id) (x ? kMagicConstant : (void*) 0);
36 extern void test6_helper(void);
37 x = (id) (test6_helper(), kMagicConstant);
40 void test7(Test7 *p) {
41 *p.prop = 0; // expected-error {{'prop' is unavailable in ARC}}
42 p.prop = 0; // expected-error {{'prop' is unavailable in ARC}}
43 *[p prop] = 0; // expected-error {{'prop' is unavailable in ARC}}
44 [p setProp: 0]; // expected-error {{'setProp:' is unavailable in ARC}}
45 // expected-note@arc-system-header.h:41 4 {{declaration uses type that is ill-formed in ARC}}
46 // expected-note@arc-system-header.h:41 2 {{property 'prop' is declared unavailable here}}
49 extern void doSomething(Test9 arg);