Fix the clang-wpa example.
[clang.git] / test / SemaObjC / synthesized-ivar.m
blob3bc372bcd81e55d6c8b4365876e34d9ba89e67bd
1 // RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s
2 @interface I
5 @property int IP;
6 @end
8 @implementation I
9 @synthesize IP;
10 - (int) Meth {
11    return IP;
13 @end
15 // rdar://7823675
16 int f0(I *a) { return a->IP; } // expected-error {{instance variable 'IP' is private}}
18 // rdar://8769582
20 @interface I1 {
21  int protected_ivar;
23 @property int PROP_INMAIN;
24 @end
26 @interface I1() {
27  int private_ivar;
29 @property int PROP_INCLASSEXT;
30 @end
32 @implementation I1
33 - (int) Meth {
34    PROP_INMAIN = 1;
35    PROP_INCLASSEXT = 2;
36    protected_ivar = 1;  // OK
37    return private_ivar; // OK
39 @end
42 @interface DER : I1
43 @end
45 @implementation DER
46 - (int) Meth {
47    protected_ivar = 1;  // OK
48    PROP_INMAIN = 1; // expected-error {{instance variable 'PROP_INMAIN' is private}}
49    PROP_INCLASSEXT = 2; // expected-error {{instance variable 'PROP_INCLASSEXT' is private}}
50    return private_ivar; // expected-error {{instance variable 'private_ivar' is private}}
52 @end