Small ChangeLog tweak.
[official-gcc.git] / gcc / testsuite / objc.dg / super-class-3.m
blobb78cd8be3e2f43cadceea94054ccf580811f4d43
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 } */
5 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
7 #include "../objc-obj-c++-shared/TestsuiteObject.m"
9 #include <stdlib.h>
10 #define CHECK_IF(expr) if(!(expr)) abort()
12 @interface _Child: TestsuiteObject
13 + (int) flashCache;
14 @end
16 @interface Child: _Child
17 + (int) flushCache1;
18 @end
20 @interface Child (Categ)
21 + (int) flushCache2;
22 @end
24 int _TestsuiteObject = 23;  /* Should not conflict with @interface TestsuiteObject.  */
26 @implementation _Child
27 + (int) flashCache { return 12 + _TestsuiteObject; }
28 @end
30 @implementation Child
31 + (int) flushCache1 { return 7 + [super flashCache]; }
32 @end
34 @implementation Child (Categ)
35 + (int) flushCache2 { return 9 + [super flashCache]; }
36 @end
38 int main(void) {
39   CHECK_IF([_Child flashCache] == 35);
40   CHECK_IF([Child flushCache1] == 42);
41   CHECK_IF([Child flushCache2] == 44);
43   return 0;