1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010. */
3 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
5 /* Test overriding a readonly @property with a readwrite one in a class extension. */
9 #include <objc/runtime.h>
11 @interface MyRootClass
20 @implementation MyRootClass
21 + (id) initialize { return self; }
22 + (id) alloc { return class_createInstance (self, 0); }
23 - (id) init { return self; }
27 /* Use a different getters/setters, so that the only way to compile
28 object.countX is to find the actual @property. */
29 @property (readonly, getter=number2) int count2;
32 @interface MySubClass : MyRootClass
37 @property (readonly, getter=number1) int count1;
40 @interface MySubClass ()
41 @property (readwrite, getter=number1, setter=setNumber1:) int count1;
44 @interface MySubClass () <count2>
45 @property (readwrite, getter=number2, setter=setNumber2:) int count2;
48 @implementation MySubClass
55 MySubClass *object = [[MySubClass alloc] init];
58 if (object.count1 != 20)
62 if (object.count2 != 11)