Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / objc.dg / property / dotsyntax-4.m
blob2db067f1fd52f7b8f4c89cab9acd567433af7536
1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
2 /* { dg-do compile } */
4 /* Test the 'dot syntax' without a declarated property.  This tests
5    syntax errors in the case where the object is a Class.  */
8 #include <stdlib.h>
9 #include <objc/objc.h>
10 #include <objc/runtime.h>
12 @interface MyRootClass
14   Class isa;
16 + (id) initialize;
17 + (id) alloc;
18 - (id) init;
19 @end
21 @implementation MyRootClass
22 + (id) initialize { return self; }
23 + (id) alloc { return class_createInstance (self, 0); }
24 - (id) init { return self; }
25 @end
27 int main (void)
29   MyRootClass.invalid = 40;      /* { dg-error "could not find setter.getter" } */
30   if (MyRootClass.invalid != 40) /* { dg-error "could not find setter.getter" } */
31     abort ();
33   MyRootClass.;           /* { dg-error "expected identifier" } */
34   if (MyRootClass.)       /* { dg-error "expected identifier" } */
35     abort ();
37   MyRootClass.int;        /* { dg-error "expected identifier" } */
38   if (MyRootClass.int)    /* { dg-error "expected identifier" } */
39     abort ();
41   return 0;