In gcc/objc/: 2010-11-08 Nicola Pero <nicola.pero@meta-innovation.com>
[official-gcc.git] / gcc / testsuite / obj-c++.dg / property / at-property-16.mm
blobca8a68c373d7ea22e9a0521745d7048a3e53ff20
1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
2 /* { dg-do compile } */
4 #include <objc/objc.h>
6 /* Test that if you have a property declared in a class and a
7    sub-class, the attributes match.  */
9 @interface MyRootClass
11   Class isa;
13 @property (assign) id a;
14 @property (retain) id b;
15 @property int c;
16 @property (nonatomic) int d;
17 @property int e;
18 @property int f;
19 @property int g;
20 @property (readonly) int h;
21 @property (readonly,getter=getMe) int i;
22 @end
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 /* FIXME - there is a problem with the testuite in running the following test.  The compiler generates the messages, but the testsuite still complains.  */
36 @interface MyClass2 : MyRootClass
37 /* @property (retain) id a; */         /*  dg-error "assign semantics attributes of property .a. conflict with previous declaration"  */
38                                  /*  dg-message "originally specified here" "" { target *-*-* } 13  */
39 /* @property (assign) id b; */         /*  dg-error "assign semantics attributes of property .b. conflict with previous declaration"  */
40                                  /*  dg-message "originally specified here" "" { target *-*-* } 14  */
41 /* @property (nonatomic) int c; */     /*  dg-error ".nonatomic. attribute of property .c. conflicts with previous declaration"  */
42                                  /*  dg-message "originally specified here" "" { target *-*-* } 15  */
43 /* @property int d; */                 /*  dg-error ".nonatomic. attribute of property .d. conflicts with previous declaration"  */
44                                  /*  dg-message "originally specified here" "" { target *-*-* } 16  */
45 /* @property (setter=setX:) int e; */  /*  dg-error ".setter. attribute of property .e. conflicts with previous declaration"  */
46                                  /*  dg-message "originally specified here" "" { target *-*-* } 17  */
47 /* @property (getter=x) int f; */      /*  dg-error ".getter. attribute of property .f. conflicts with previous declaration"  */
48                                  /*  dg-message "originally specified here" "" { target *-*-* } 18  */
49 /* @property (readonly) int g; */      /*  dg-error ".readonly. attribute of property .g. conflicts with previous declaration"  */
50                                  /*  dg-message "originally specified here" "" { target *-*-* } 19  */
51 @property (readwrite) int h;     /* Ok */
52 /* @property (readonly) int i; */      /*  dg-error ".getter. attribute of property .i. conflicts with previous declaration"  */
53                                  /*  dg-message "originally specified here" "" { target *-*-* } 21  */
54 @end