1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */
2 /* { dg-do compile } */
3 /* { dg-options "-Wall" } */
5 /* Test warnings with the dot-syntax. */
9 #include <objc/runtime.h>
11 @interface MyRootClass
27 @implementation MyRootClass
28 + (id) initialize { return self; }
29 + (id) alloc { return class_createInstance (self, 0); }
30 - (id) init { return self; }
37 MyRootClass *object = [[MyRootClass alloc] init];
39 /* First, test that the artificial code generated by dot-syntax does
40 not generate unexpected warnings. */
42 /* All of the following should generate no warnings. */
45 object.p1 = object.p2 = 0;
57 /* Now test some warnings. */
58 object.p1; /* { dg-warning "value computed is not used" } */
60 /* TODO: It would be good to get the following to warn. */
61 if (object.p1 = 0) /* dg-warning "suggest parentheses around assignment used as truth value" */