* tree-loop-distribution.c (struct partition): New field recording
[official-gcc.git] / gcc / testsuite / obj-c++.dg / property / dotsyntax-3.mm
blobd3478062882cb1f9b6ee455a2c0a588d2bb01e56
1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
2 /* { dg-do run } */
3 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
5 /* Test the 'dot syntax' without a declarated property.  This tests the case where
6    the object is a Class.  */
9 #include <stdlib.h>
10 #include <objc/objc.h>
11 #include <objc/runtime.h>
13 static int a;
14 static id b;
16 @interface MyRootClass
18   Class isa;
20 + (id) initialize;
21 + (id) alloc;
22 - (id) init;
23 + (int) count;
24 + (void) setCount: (int)value;
25 + (id) next;
26 + (void) setNext: (id)value;
27 @end
29 @implementation MyRootClass
30 + (id) initialize { return self; }
31 + (id) alloc { return class_createInstance (self, 0); }
32 - (id) init { return self; }
33 + (int) count
35   return a;
37 + (void) setCount: (int)value
39   a = value;
41 + (id) next
43   return b;
45 + (void) setNext: (id)value
47   b = value;
49 @end
51 int main (void)
53   MyRootClass *object = [[MyRootClass alloc] init];
55   MyRootClass.count = 40;
56   if (MyRootClass.count != 40)
57     abort ();
59   MyRootClass.next = object;
60   if (MyRootClass.next != object)
61     abort ();
63   return 0;