Debian Codegraph @

gcc/testsuite/obj-c++.dg/ivar-problem-1.mm

raw
1 /* Contributed by Nicola Pero <[email protected]>, November 2010. */
2 /* { dg-do compile } */
3 // { dg-additional-options "-Wno-objc-root-class" }
4
5 /* This test checks what happens if there are 16 instance variables.
6 In that case, the class was not created correctly. In this testcase,
7 we have two classes, one with 15 variables and one with 16. Older
8 GCCs would generate a bogus warning for the second class but not
9 for the first one. This only happened for ObjC, but it's good to
10 test ObjC++ as well. */
11
12 #include <stdlib.h>
13 #include <objc/objc.h>
14
15 @interface MyRootClass1
16 {
17 Class isa;
18 int v2;
19 int v3;
20 int v4;
21 int v5;
22 int v6;
23 int v7;
24 int v8;
25 int v9;
26 int v10;
27 int v11;
28 int v12;
29 int v13;
30 int v14;
31 int v15;
32 }
33 - (id) init;
34 @end
35
36 @implementation MyRootClass1
37 - (id) init { return self; }
38 @end
39
40
41 @interface MyRootClass2
42 {
43 Class isa;
44 int v2;
45 int v3;
46 int v4;
47 int v5;
48 int v6;
49 int v7;
50 int v8;
51 int v9;
52 int v10;
53 int v11;
54 int v12;
55 int v13;
56 int v14;
57 int v15;
58 /* Adding the 16th variable used to cause bogus warnings to be
59 generated. */
60 int v16;
61 }
62 - (id) init;
63 @end
64
65 @implementation MyRootClass2
66 - (id) init { return self; } /* This should not generate a bogus warning. */
67 @end