1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */
3 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
5 /* Test properties of different types. */
9 #include <objc/runtime.h>
11 enum colour { Red, Black };
13 @interface MyRootClass
23 @implementation MyRootClass
24 + (id) initialize { return self; }
25 + (id) alloc { return class_createInstance (self, 0); }
26 - (id) init { return self; }
27 + (Class) class { return self; }
31 @interface MyClass : MyRootClass
33 /* A bunch of C types. */
42 /* A bunch of pointers to C types. */
51 /* A bunch of Objective-C types. */
56 @property (assign) char pchar;
57 @property (assign) short pshort;
58 @property (assign) int pint;
59 @property (assign) long plong;
60 @property (assign) float pfloat;
61 @property (assign) double pdouble;
62 @property (assign) enum colour penum;
64 @property (assign) char *pcharp;
65 @property (assign) short *pshortp;
66 @property (assign) int *pintp;
67 @property (assign) long *plongp;
68 @property (assign) float *pfloatp;
69 @property (assign) double *pdoublep;
70 @property (assign) enum colour *penump;
72 @property (assign) id pid;
73 @property (assign) Class pclass;
74 @property (assign) MyClass *pMyClassp;
77 @implementation MyClass
96 @synthesize pMyClassp;
101 MyClass *object = [[MyClass alloc] init];
104 if (object.pchar != 1)
108 if (object.pshort != 2)
112 if (object.pint != 3)
116 if (object.plong != 4)
120 if (object.pfloat != 0)
124 if (object.pdouble != 0)
127 object.penum = Black;
128 if (object.penum != Black)
131 object.pcharp = (char *)0;
132 if (object.pcharp != 0)
135 object.pshortp = (short *)0;
136 if (object.pshortp != 0)
139 object.pintp = (int *)0;
140 if (object.pintp != 0)
143 object.plongp = (long *)0;
144 if (object.plongp != 0)
147 object.pfloatp = (float *)0;
148 if (object.pfloatp != 0)
151 object.pdoublep = (double *)0;
152 if (object.pdoublep != 0)
155 object.penump = (enum colour *)0;
156 if (object.penump != 0)
160 if (object.pid != object)
163 object.pclass = [MyClass class];
164 if (object.pclass != [MyClass class])
167 object.pMyClassp = object;
168 if (object.pMyClassp != object)