2007-03-01 Paul Brook <paul@codesourcery.com>
[official-gcc.git] / gcc / testsuite / objc.dg / super-class-3.m
blob85396c236915d7496be74ebc535b78eff8936aa2
1 /* Ensure that the compiler does not emit spurious extern declarations named '_Foo', where 'Foo'
2    is an ObjC class name.  */
3 /* Contributed by Ziemowit Laski <zlaski@apple.com>.  */
4 /* { dg-do run } */
6 #include <objc/Object.h>
7 #include <stdlib.h>
8 #define CHECK_IF(expr) if(!(expr)) abort()
10 @interface _Child: Object
11 + (int) flashCache;
12 @end
14 @interface Child: _Child
15 + (int) flushCache1;
16 @end
18 @interface Child (Categ)
19 + (int) flushCache2;
20 @end
22 int _Object = 23;  /* Should not conflict with @interface Object.  */
24 @implementation _Child
25 + (int) flashCache { return 12 + _Object; }
26 @end
28 @implementation Child
29 + (int) flushCache1 { return 7 + [super flashCache]; }
30 @end
32 @implementation Child (Categ)
33 + (int) flushCache2 { return 9 + [super flashCache]; }
34 @end
36 int main(void) {
37   CHECK_IF([_Child flashCache] == 35);
38   CHECK_IF([Child flushCache1] == 42);
39   CHECK_IF([Child flushCache2] == 44);
41   return 0;