Small ChangeLog tweak.
[official-gcc.git] / gcc / testsuite / objc.dg / property / synthesize-2.m
blob92170678f3c0f6fe3d026aea2b73bf11d5f4b850
1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010.  */
2 /* { dg-do run } */
3 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
5 #include <objc/objc.h>
6 #include <objc/runtime.h>
7 #include <stdlib.h>
9 @interface MyRootClass
11   Class isa;
13 + (id) initialize;
14 + (id) alloc;
15 - (id) init;
16 @end
18 @implementation MyRootClass
19 + (id) initialize { return self; }
20 + (id) alloc { return class_createInstance (self, 0); }
21 - (id) init { return self; }
22 @end
24 @interface Test : MyRootClass
26   int v1;
28 @property int v1;
29 /* TODO: Test more types of properties with different semantics
30    (retain, copy, atomic, nonatomic, and test various C and
31    Objective-C types).  */
32 @end
34 @implementation Test
35 @synthesize v1;
36 @end
38 int main (void)
40   Test *object = [[Test alloc] init];
42   /* Check that the synthesized methods exist and work.  Do not invoke
43      them via property syntax - that is another test.  Here we just
44      want to test the synthesis of the methods.  */
45   [object setV1: 400];
47   if ([object v1] != 400)
48     abort ();
50   return 0;