]> gcc.gnu.org Git - gcc.git/blob - gcc/testsuite/obj-c++.dg/property/at-property-4.mm
e327930f87b5812a85c14fb25f743b44b628234b
[gcc.git] / gcc / testsuite / obj-c++.dg / property / at-property-4.mm
1 /* { dg-do compile } */
2
3 #include <objc/objc.h>
4
5 @interface MyRootClass
6 {
7 Class isa;
8 }
9 - (int) myGetter;
10 - (int) myGetterB;
11 - (int) myGetter2;
12 - (void) mySetter: (int)property;
13 - (void) mySetterB: (int)property;
14 - (void) mySetter2: (int)property;
15
16 /* Test that all the new property attributes can be parsed. */
17 @property (assign) id property_a;
18 @property (copy) id property_b;
19 @property (nonatomic) int property_c;
20 @property (readonly) int property_d;
21 @property (readwrite) int property_e;
22 @property (retain) id property_f;
23 @property (release) int property_g; /* { dg-error "unknown property attribute" } */
24
25 @property (getter=myGetter) int property_h;
26 @property (setter=mySetter:) int property_i;
27
28 /* Now test various problems. */
29
30 @property (readonly, readwrite) int a; /* { dg-error ".readonly. attribute conflicts with .readwrite. attribute" } */
31 @property (readonly, setter=mySetterB:) int b; /* { dg-warning ".readonly. attribute conflicts with .setter. attribute" } */
32
33 @property (assign, retain) id c; /* { dg-error ".assign. attribute conflicts with .retain. attribute" } */
34 @property (assign, copy) id d; /* { dg-error ".assign. attribute conflicts with .copy. attribute" } */
35 @property (copy, retain) id e; /* { dg-error ".retain. attribute conflicts with .copy. attribute" } */
36
37 @property (setter=mySetter:,setter=mySetter2:) int f; /* { dg-error ".setter. attribute may only be specified once" } */
38 @property (getter=myGetter, getter=myGetter2 ) int g; /* { dg-error ".getter. attribute may only be specified once" } */
39
40 @end
This page took 0.038184 seconds and 4 git commands to generate.