diff options
Diffstat (limited to 'gcc/testsuite/objc.dg/super-class-3.m')
-rw-r--r-- | gcc/testsuite/objc.dg/super-class-3.m | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/gcc/testsuite/objc.dg/super-class-3.m b/gcc/testsuite/objc.dg/super-class-3.m new file mode 100644 index 000000000..fc74871db --- /dev/null +++ b/gcc/testsuite/objc.dg/super-class-3.m @@ -0,0 +1,46 @@ +/* Ensure that the compiler does not emit spurious extern declarations named '_Foo', where 'Foo' + is an ObjC class name. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ + +#include "../objc-obj-c++-shared/Object1.h" + +#include <stdlib.h> +#define CHECK_IF(expr) if(!(expr)) abort() + +@interface _Child: Object ++ (int) flashCache; +@end + +@interface Child: _Child ++ (int) flushCache1; +@end + +@interface Child (Categ) ++ (int) flushCache2; +@end + +int _Object = 23; /* Should not conflict with @interface Object. */ + +@implementation _Child ++ (int) flashCache { return 12 + _Object; } +@end + +@implementation Child ++ (int) flushCache1 { return 7 + [super flashCache]; } +@end + +@implementation Child (Categ) ++ (int) flushCache2 { return 9 + [super flashCache]; } +@end + +int main(void) { + CHECK_IF([_Child flashCache] == 35); + CHECK_IF([Child flushCache1] == 42); + CHECK_IF([Child flushCache2] == 44); + + return 0; +} + +#include "../objc-obj-c++-shared/Object1-implementation.h" |