blob: 1a7c39d4e1cde7b18296ea202dd019bac3c1fa01 [file] [log] [blame]
John McCallf85e1932011-06-15 23:02:42 +00001// silly workaround expected-note {{marked unavailable here}}
John McCalld1e40d52011-10-02 01:16:38 +00002// RUN: %clang_cc1 -fobjc-arc -isystem %S/Inputs %s -DNO_USE
3// RUN: %clang_cc1 -fobjc-arc -isystem %S/Inputs %s -verify
John McCallf85e1932011-06-15 23:02:42 +00004
5// another silly workaround expected-note {{marked unavailable here}}
6#include <arc-system-header.h>
7
8#ifndef NO_USE
9void test(id op, void *cp) {
10 cp = test0(op); // expected-error {{'test0' is unavailable: converts between Objective-C and C pointers in -fobjc-arc}}
11 cp = *test1(&op); // expected-error {{'test1' is unavailable: converts between Objective-C and C pointers in -fobjc-arc}}
12}
13
14// workaround expected-note {{marked unavailable here}}
15void test3(struct Test3 *p) {
16 p->field = 0; // expected-error {{'field' is unavailable: this system declaration uses an unsupported type}}
17}
18
19// workaround expected-note {{marked unavailable here}}
20void test4(Test4 *p) {
21 p->field1 = 0; // expected-error {{'field1' is unavailable: this system declaration uses an unsupported type}}
22 p->field2 = 0;
23}
24
25// workaround expected-note {{marked unavailable here}}
26void test5(struct Test5 *p) {
Argyrios Kyrtzidisb8b03132011-06-24 00:08:59 +000027 p->field = 0; // expected-error {{'field' is unavailable: this system field has retaining ownership}}
John McCallf85e1932011-06-15 23:02:42 +000028}
29
30id test6() {
31 // This is actually okay to use if declared in a system header.
32 id x;
33 x = (id) kMagicConstant;
34 x = (id) (x ? kMagicConstant : kMagicConstant);
35 x = (id) (x ? kMagicConstant : (void*) 0);
36
37 extern void test6_helper();
38 x = (id) (test6_helper(), kMagicConstant);
39}
40
41// workaround expected-note 4 {{marked unavailable here}}
42void test7(Test7 *p) {
43 *p.prop = 0; // expected-error {{'prop' is unavailable: this system declaration uses an unsupported type}}
44 p.prop = 0; // expected-error {{'prop' is unavailable: this system declaration uses an unsupported type}}
45 *[p prop] = 0; // expected-error {{'prop' is unavailable: this system declaration uses an unsupported type}}
46 [p setProp: 0]; // expected-error {{'setProp:' is unavailable: this system declaration uses an unsupported type}}
47}
48#endif
John McCallb64915a2011-06-17 21:56:12 +000049
50// test8 in header