Debian Codegraph @

gcc/testsuite/objc.dg/property/dotsyntax-11.m

raw
1 /* Contributed by Nicola Pero <[email protected]>, November 2010. */
2 /* { dg-do compile } */
3
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. */
6
7 #include <stdlib.h>
8 #include <objc/objc.h>
9 #include <objc/runtime.h>
10
11 static int c;
12
13 @interface MyRootClass
14 {
15 Class isa;
16 int a;
17 }
18 + (id) initialize;
19 + (id) alloc;
20 - (id) init;
21 - (void) setCount: (int)count;
22 + (void) setClassCount: (int)count;
23 @end
24
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
30 {
31 a = count;
32 }
33 + (void) setClassCount: (int)count
34 {
35 c = count;
36 }
37 @end
38
39 @interface MySubClass : MyRootClass
40 + (int) testMe;
41 - (int) testMe;
42 @end
43
44 @implementation MySubClass
45 - (int) testMe
46 {
47 super.count = 400;
48 if (super.count != 400) /* { dg-error "no .count. getter found" } */
49 abort ();
50
51 return super.count; /* { dg-error "no .count. getter found" } */
52 }
53 + (int) testMe
54 {
55 super.classCount = 4000;
56 if (super.classCount != 4000) /* { dg-error "no .classCount. getter found" } */
57 abort ();
58
59 return super.classCount; /* { dg-error "no .classCount. getter found" } */
60 }
61 @end