1 /* test access in methods, auto-generated getter/setter based on property name. */
3 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
9 extern int printf (const char *fmt,...);
10 extern void abort (void);
12 #include <objc/objc.h>
13 #include <objc/runtime.h>
29 - (int) lookAtProperty;
30 - (void) setProperty: (int) v;
37 +initialize { return self;}
38 + (id) alloc { return class_createInstance(self, 0);}
40 - (id) init {return self;}
44 - (int) lookAtProperty { return FooBar; }
45 - (void) setProperty: (int) v { FooBar = v; }
49 int main(int argc, char *argv[]) {
51 Bar *f = [[Bar alloc] init];
53 /* First, establish that the property getter & setter have been synthesized
54 and operate correctly. */
58 { printf ("setProperty did not set FooBar\n"); abort ();}
60 res = [f lookAtProperty];
62 { printf ("[f lookAtProperty] = %d\n", res); abort ();}
64 /* Make sure we haven't messed up the shortcut form. */
68 { printf ("f.FooBar = %d\n", res); abort ();}
72 /* printf ("seems OK\n", res); */