OSDN Git Service

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