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" } { "" } } */
5 extern int printf (char *fmt,...) ;
6 extern void abort (void);
9 #include <objc/runtime.h>
21 - (int) lookAtProperty;
22 - (void) setProperty: (int) v;
29 +initialize { return self;}
30 + (id) alloc { return class_createInstance(self, 0);}
32 - (id) init {return self;}
36 - (int) lookAtProperty { return FooBar; }
37 - (void) setProperty: (int) v { FooBar = v; }
41 int main(int argc, char *argv[]) {
43 Bar *f = [[Bar alloc] init];
45 /* First, establish that the property getter & setter have been synthesized
46 and operate correctly. */
50 { printf ("setProperty did not set FooBar\n"); abort ();}
52 res = [f lookAtProperty];
54 { printf ("[f lookAtProperty] = %d\n", res); abort ();}
56 /* Make sure we haven't messed up the shortcut form. */
60 { printf ("f.FooBar = %d\n", res); abort ();}
64 /* printf ("seems OK\n", res); */