1 /* { dg-do compile } */
12 - (void) mySetter: (int)property;
13 - (void) mySetterB: (int)property;
14 - (void) mySetter2: (int)property;
16 /* Test that all the new property attributes can be parsed. */
17 @property (assign) id property_as_1;
18 @property (copy) id property_as_2;
19 @property (retain) id property_as_3;
21 @property (atomic) int property_at_1;
22 @property (nonatomic) int property_at_2;
24 @property (readonly) int property_rw_1;
25 @property (readwrite) int property_rw_2;
27 @property (class) int property_cl_1;
29 @property (null_unspecified) int *property_null_1;
30 @property (nullable) int *property_null_2;
31 @property (nonnull) int *property_null_3;
32 @property (null_resettable) int *property_null_4;
34 @property (release) int property_err_1; /* { dg-error "unknown property attribute" } */
36 @property (getter=myGetter) int property_h;
37 @property (setter=mySetter:) int property_i;
39 /* Now test various problems. */
41 @property (readonly, readwrite) int a; /* { dg-error ".readwrite. attribute conflicts with .readonly. attribute" } */
42 @property (readonly, setter=mySetterB:) int b; /* { dg-error ".readonly. attribute conflicts with .setter. attribute" } */
44 @property (assign, retain) id c; /* { dg-error ".retain. attribute conflicts with .assign. attribute" } */
45 @property (assign, copy) id d; /* { dg-error ".copy. attribute conflicts with .assign. attribute" } */
46 @property (copy, retain) id e; /* { dg-error ".retain. attribute conflicts with .copy. attribute" } */
48 @property (atomic, nonatomic) int property_j; /* { dg-error {'nonatomic' attribute conflicts with 'atomic' attribute} } */
50 @property (null_unspecified) int property_bad_t_1; /* { dg-error {nullability specifier 'null_unspecified' cannot be applied to non-pointer type 'int'} } */
51 @property (nullable) int property_bad_t_2;/* { dg-error {nullability specifier 'nullable' cannot be applied to non-pointer type 'int'} } */
52 @property (nonnull) int property_bad_t_3;/* { dg-error {nullability specifier 'nonnull' cannot be applied to non-pointer type 'int'} } */
53 @property (null_resettable) int property_bad_t_4;/* { dg-error {nullability specifier 'null_resettable' cannot be applied to non-pointer type 'int'} } */
54 @property (nullable) int **property_bad_t_5;/* { dg-error {nullability specifier 'nullable' cannot be applied to multi-level pointer type 'int \*\*'} } */
56 @property (null_unspecified, nullable) int *property_ne_1; /* { dg-error {'nullable' attribute conflicts with 'null_unspecified' attribute} } */
57 @property (null_unspecified, nonnull) int *property_ne_2; /* { dg-error {'nonnull' attribute conflicts with 'null_unspecified' attribute} } */
58 @property (null_unspecified, null_resettable) int *property_ne_3; /* { dg-error {'null_resettable' attribute conflicts with 'null_unspecified' attribute} } */
59 @property (nullable,nonnull) int *property_ne_4; /* { dg-error {'nonnull' attribute conflicts with 'nullable' attribute} } */
60 @property (nullable,null_resettable) int *property_ne_5; /* { dg-error {'null_resettable' attribute conflicts with 'nullable' attribute} } */
61 @property (nonnull, null_resettable) int *property_ne_6; /* { dg-error {'null_resettable' attribute conflicts with 'nonnull' attribute} } */
63 @property (setter=mySetter:,setter=mySetter2:) int f; /* { dg-warning {multiple property 'setter' methods specified, the latest one will be used} } */
64 @property (getter=myGetter, getter=myGetter2 ) int g; /* { dg-warning {multiple property 'getter' methods specified, the latest one will be used} } */