blob: 4786d808fa2ffe274ddcde23bd66e865cc4a6981 [file] [log] [blame]
Fariborz Jahanian112c3302011-01-04 20:05:20 +00001// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s
Fariborz Jahanianaf3e7222009-03-31 00:06:29 +00002@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 Jahanian2846b2b2010-04-06 23:36:17 +000014
Fariborz Jahanian24fce282010-11-09 02:16:57 +000015// rdar://7823675
Fariborz Jahanian75049662010-12-15 23:29:04 +000016int 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 McCallf85e1932011-06-15 23:02:42 +000054@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