Home | History | Annotate | Download | only in SemaObjC
      1 // RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -verify -Wno-objc-root-class %s
      2 @interface I
      3 {
      4 }
      5 @property int IP;
      6 @end
      7 
      8 @implementation I
      9 @synthesize IP;
     10 - (int) Meth {
     11    return IP;
     12 }
     13 @end
     14 
     15 // rdar://7823675
     16 int f0(I *a) { return a->IP; } // expected-error {{instance variable 'IP' is private}}
     17 
     18 // rdar://8769582
     19 
     20 @interface I1 {
     21  int protected_ivar;
     22 }
     23 @property int PROP_INMAIN;
     24 @end
     25 
     26 @interface I1() {
     27  int private_ivar;
     28 }
     29 @property int PROP_INCLASSEXT;
     30 @end
     31 
     32 @implementation I1
     33 - (int) Meth {
     34    _PROP_INMAIN = 1;
     35    _PROP_INCLASSEXT = 2;
     36    protected_ivar = 1;	// OK
     37    return private_ivar; // OK
     38 }
     39 @end
     40 
     41 
     42 @interface DER : I1
     43 @end
     44 
     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}}
     51 }
     52 @end
     53 
     54 @interface A
     55 @property (weak) id testObjectWeakProperty; // expected-note {{declared here}}
     56 @end
     57 
     58 @implementation A
     59 // rdar://9605088
     60 @synthesize testObjectWeakProperty; // expected-error {{@synthesize of 'weak' property is only allowed in ARC or GC mode}}
     61 @end
     62