Debian Codegraph @

gcc/testsuite/obj-c++.dg/property/synthesize-6.mm

raw
1 /* Contributed by Nicola Pero <[email protected]>, November 2010. */
2 /* { dg-do compile } */
3
4 /* Test that each @synthesize is using a different instance variable,
5 and that it must belong to the class (not to a superclass). */
6
7 #include <objc/objc.h>
8
9 @interface Test
10 {
11 int v;
12 int w;
13 }
14 @property int v1;
15 @property int v2;
16 @end
17 @implementation Test
18 @synthesize v1 = v; /* { dg-message "originally specified here" } */
19 @synthesize v2 = v; /* { dg-error "property .v2. is using the same instance variable as property .v1." } */
20 @end
21 @interface Test2 : Test
22 @property int w1;
23 @end
24
25 @implementation Test2
26 @synthesize w1; /* { dg-error "ivar .w1. used by .@synthesize. declaration must be an existing ivar" } */
27 @end
28 /* { dg-warning "incomplete implementation" "" { target *-*-* } .-1 } */
29 /* { dg-message "method definition for .-setW1:. not found" "" { target *-*-* } .-2 } */
30 /* { dg-message "method definition for .-w1. not found" "" { target *-*-* } .-3 } */