Debian Codegraph @

gcc/testsuite/obj-c++.dg/property/at-property-11.mm

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 that properties are found even if implemented in superclasses. */
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 }
16 @property (nonatomic) int a;
17 + (id) initialize;
18 + (id) alloc;
19 - (id) init;
20 @end
21
22 @implementation MyRootClass
23 + (id) initialize { return self; }
24 + (id) alloc { return class_createInstance (self, 0); }
25 - (id) init { return self; }
26 @synthesize a;
27 @end
28
29 @interface MySubClass : MyRootClass
30 @end
31
32 @implementation MySubClass
33 @end
34
35 int main (void)
36 {
37 MySubClass *object = [[MySubClass alloc] init];
38
39 object.a = 40;
40 if (object.a != 40)
41 abort ();
42
43 return (0);
44 }