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 more tricky assignments. */
9 #include <objc/runtime.h>
11 @interface MyRootClass
23 @property (assign) id object1;
24 @property (assign) id object2;
33 @implementation MyRootClass
34 + (id) initialize { return self; }
35 + (id) alloc { return class_createInstance (self, 0); }
36 - (id) init { return self; }
37 @synthesize object1 = a;
38 @synthesize object2 = b;
41 /* Test multiple assignments with 'self'. */
42 self.object1 = self.object2 = self;
44 if (self.object1 != self || self.object2 != self)
47 /* Test multiple assignments with a conditional and method calls. */
48 self.object1 = self.object2 = (self ? [self myself] : [self nilObject]);
50 if (self.object1 != self || self.object2 != self)
53 self.object1 = self.object2 = (self ? [self nilObject] : [self myself]);
55 if (self.object1 != nil || self.object2 != nil)
75 MyRootClass *object = [[MyRootClass alloc] init];
76 MyRootClass *object1 = [[MyRootClass alloc] init];
80 /* Now, test multiple assignments with different types. Use
81 int/float as they seem to happily crash the compiler in gimplify
82 if proper conversions are not being generated by the
84 object.p1 = object.p2 = 12;
86 if (object.p1 != 12 || object.p2 != 12)
89 object.p1 = object.p2 = 2.7;
94 /* Just try a different loop, mixing in a few different standard C
95 constructs to cover a few other cases. */
100 object1.p1 += ((object.p2 = 4.56) ? 0 : object.p1);
104 if (object.p1 != 0 || object1.p1 != 0)