Fariborz Jahanian | 112c330 | 2011-01-04 20:05:20 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s |
Fariborz Jahanian | af3e722 | 2009-03-31 00:06:29 +0000 | [diff] [blame] | 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 |
Fariborz Jahanian | 2846b2b | 2010-04-06 23:36:17 +0000 | [diff] [blame] | 14 | |
Fariborz Jahanian | 24fce28 | 2010-11-09 02:16:57 +0000 | [diff] [blame] | 15 | // rdar://7823675 |
Fariborz Jahanian | 7504966 | 2010-12-15 23:29:04 +0000 | [diff] [blame] | 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 | |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 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 |