blob: 3bc2e3386b00fe71e2d0506c8f95bff9d834d44f [file] [log] [blame]
Fariborz Jahanianc35b9e42008-04-21 21:05:54 +00001// RUN: clang -fsyntax-only -verify %s
2
3@interface I
4{
5 int IVAR;
Fariborz Jahanian6cdf16d2008-04-21 21:57:36 +00006 int name;
Fariborz Jahanianc35b9e42008-04-21 21:05:54 +00007}
8@property int d1;
9@property id prop_id;
Fariborz Jahanian6cdf16d2008-04-21 21:57:36 +000010@property int name;
Fariborz Jahanianc35b9e42008-04-21 21:05:54 +000011@end
12
13@interface I(CAT)
14@property int d1;
15@end
16
17@implementation I
Fariborz Jahanian6cdf16d2008-04-21 21:57:36 +000018@synthesize d1; // expected-error {{synthesized property 'd1' must either be named the same as}}
19@dynamic bad; // expected-error {{property implementation must have its declaration in interface 'I'}}
20@synthesize prop_id; // expected-error {{synthesized property 'prop_id' must either be named the same}}
Fariborz Jahanianc35b9e42008-04-21 21:05:54 +000021@synthesize prop_id = IVAR; // expected-error {{type of property 'prop_id' does not match type of ivar 'IVAR'}}
Fariborz Jahanian6cdf16d2008-04-21 21:57:36 +000022@synthesize name; // OK! property with same name as an accessible ivar of same name
Fariborz Jahanianc35b9e42008-04-21 21:05:54 +000023@end
24
25@implementation I(CAT)
26@synthesize d1; // expected-error {{@synthesize not allowed in a category's implementation}}
27@dynamic bad; // expected-error {{property implementation must have its declaration in the category 'CAT'}}
28@end
29
30@implementation E // expected-warning {{cannot find interface declaration for 'E'}}
Fariborz Jahanian6cdf16d2008-04-21 21:57:36 +000031@dynamic d; // expected-error {{property implementation must have its declaration in interface 'E'}}
Fariborz Jahanianc35b9e42008-04-21 21:05:54 +000032@end
33
34@implementation Q(MYCAT) // expected-error {{cannot find interface declaration for 'Q'}}
35@dynamic d; // expected-error {{property implementation in a category with no category declaration}}
36@end
37
38
39