Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / obj-c++.dg / property / dotsyntax-11.mm
blob6c9d924ca82ae32a05539bd9376ff9794324add1
1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
2 /* { dg-do compile } */
4 /* Test the error reporting for the dot-syntax in the scenario where
5    we have a setter, but not a getter, yet a getter is requested.  */
7 #include <stdlib.h>
8 #include <objc/objc.h>
9 #include <objc/runtime.h>
11 static int c;
13 @interface MyRootClass
15   Class isa;
16   int a;
18 + (id) initialize;
19 + (id) alloc;
20 - (id) init;
21 - (void) setCount: (int)count;
22 + (void) setClassCount: (int)count;
23 @end
25 @implementation MyRootClass
26 + (id) initialize { return self; }
27 + (id) alloc { return class_createInstance (self, 0); }
28 - (id) init { return self; }
29 - (void) setCount: (int)count
31   a = count;
33 + (void) setClassCount: (int)count
35   c = count;
37 @end
39 @interface MySubClass : MyRootClass
40 + (int) testMe;
41 - (int) testMe;
42 @end
44 @implementation MySubClass
45 - (int) testMe
47   super.count = 400;
48   if (super.count != 400) /* { dg-error "no .count. getter found" } */
49     abort ();             
51   return super.count;     /* { dg-error "no .count. getter found" } */
53 + (int) testMe
55   super.classCount = 4000;
56   if (super.classCount != 4000) /* { dg-error "no .classCount. getter found" } */
57     abort ();
59   return super.classCount;      /* { dg-error "no .classCount. getter found" } */
61 @end