]>
Commit | Line | Data |
---|---|---|
4ca5d2a7 NP |
1 | /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */ |
2 | /* { dg-do compile } */ | |
3 | ||
4 | #include <objc/objc.h> | |
5 | ||
6 | /* Test that if you have a property declared in a class and a | |
7 | sub-class, the attributes match. */ | |
8 | ||
9 | @interface MyRootClass | |
10 | { | |
11 | Class isa; | |
12 | } | |
b5be38bc TV |
13 | @property (assign) id a; /* { dg-line MyRootClass_property_a } */ |
14 | @property (retain) id b; /* { dg-line MyRootClass_property_b } */ | |
15 | @property int c; /* { dg-line MyRootClass_property_c } */ | |
16 | @property (nonatomic) int d; /* { dg-line MyRootClass_property_d } */ | |
17 | @property int e; /* { dg-line MyRootClass_property_e } */ | |
18 | @property int f; /* { dg-line MyRootClass_property_f } */ | |
19 | @property int g; /* { dg-line MyRootClass_property_g } */ | |
20 | @property (readonly) int h; | |
21 | @property (readonly,getter=getMe) int i; /* { dg-line MyRootClass_property_i } */ | |
4ca5d2a7 NP |
22 | @end |
23 | ||
24 | @interface MyClass : MyRootClass | |
25 | @property (assign) id a; | |
26 | @property (retain) id b; | |
27 | @property int c; | |
28 | @property (nonatomic) int d; | |
29 | @property int e; | |
30 | @property int f; | |
31 | @property int g; | |
32 | @property (readonly) int h; | |
33 | @property (readonly,getter=getMe) int i; | |
34 | @end | |
35 | ||
36 | @interface MyClass2 : MyRootClass | |
8926bd5d | 37 | @property (retain) id a; /* { dg-warning "assign semantics attributes of property .a. conflict with previous declaration" } */ |
b5be38bc | 38 | /* { dg-message "originally specified here" "" { target *-*-* } MyRootClass_property_a } */ |
8926bd5d | 39 | @property (assign) id b; /* { dg-warning "assign semantics attributes of property .b. conflict with previous declaration" } */ |
b5be38bc | 40 | /* { dg-message "originally specified here" "" { target *-*-* } MyRootClass_property_b } */ |
8926bd5d | 41 | @property (nonatomic) int c; /* { dg-warning ".nonatomic. attribute of property .c. conflicts with previous declaration" } */ |
b5be38bc | 42 | /* { dg-message "originally specified here" "" { target *-*-* } MyRootClass_property_c } */ |
8926bd5d | 43 | @property int d; /* { dg-warning ".nonatomic. attribute of property .d. conflicts with previous declaration" } */ |
b5be38bc | 44 | /* { dg-message "originally specified here" "" { target *-*-* } MyRootClass_property_d } */ |
8926bd5d | 45 | @property (setter=setX:) int e; /* { dg-warning ".setter. attribute of property .e. conflicts with previous declaration" } */ |
b5be38bc | 46 | /* { dg-message "originally specified here" "" { target *-*-* } MyRootClass_property_e } */ |
8926bd5d | 47 | @property (getter=x) int f; /* { dg-warning ".getter. attribute of property .f. conflicts with previous declaration" } */ |
b5be38bc | 48 | /* { dg-message "originally specified here" "" { target *-*-* } MyRootClass_property_f } */ |
8926bd5d | 49 | @property (readonly) int g; /* { dg-warning ".readonly. attribute of property .g. conflicts with previous declaration" } */ |
b5be38bc | 50 | /* { dg-message "originally specified here" "" { target *-*-* } MyRootClass_property_g } */ |
4ca5d2a7 | 51 | @property (readwrite) int h; /* Ok */ |
8926bd5d | 52 | @property (readonly) int i; /* { dg-warning ".getter. attribute of property .i. conflicts with previous declaration" } */ |
b5be38bc | 53 | /* { dg-message "originally specified here" "" { target *-*-* } MyRootClass_property_i } */ |
4ca5d2a7 NP |
54 | @end |
55 |