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 dot-syntax with pre/post increment and decrement. */
9 #include <objc/runtime.h>
11 @interface MyRootClass
20 - (void) setCount: (int)count;
23 @implementation MyRootClass
24 + (id) initialize { return self; }
25 + (id) alloc { return class_createInstance (self, 0); }
26 - (id) init { return self; }
31 - (void) setCount: (int)count
39 MyRootClass *object = [[MyRootClass alloc] init];
42 if (object.count != 10)
45 /* First, test that they increment/decrement as expected. */
47 if (object.count != 11)
51 if (object.count != 12)
55 if (object.count != 11)
59 if (object.count != 10)
62 /* Now, test that they are pre/post increment/decrement, as
64 if (object.count++ != 10)
67 if (object.count != 11)
70 if (++object.count != 12)
73 if (object.count != 12)
76 if (object.count-- != 12)
79 if (object.count != 11)
82 if (--object.count != 10)
85 if (object.count != 10)