Debian Codegraph @

gcc/testsuite/objc.dg/property/at-property-12.m

raw
1 /* Contributed by Nicola Pero <[email protected]>, October 2010. */
2 /* { dg-do run } */
3 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
4
5 /* Test atomic, assign synthesized methods. */
6
7 #include <stdlib.h>
8 #include <objc/objc.h>
9 #include <objc/runtime.h>
10
11 @interface MyRootClass
12 {
13 Class isa;
14 int a;
15 id b;
16 }
17 @property int a;
18 @property (assign) id b;
19 + (id) initialize;
20 + (id) alloc;
21 - (id) init;
22 @end
23
24 @implementation MyRootClass
25 + (id) initialize { return self; }
26 + (id) alloc { return class_createInstance (self, 0); }
27 - (id) init { return self; }
28 @synthesize a;
29 @synthesize b;
30 @end
31
32 int main (void)
33 {
34 MyRootClass *object = [[MyRootClass alloc] init];
35
36 object.a = 40;
37 if (object.a != 40)
38 abort ();
39
40 object.b = object;
41 if (object.b != object)
42 abort ();
43
44 return 0;
45 }
46
47