1 /* Test class methods inside categories. */
2 /* Author: Ziemowit Laski <zlaski@apple.com>. */
5 /* { dg-xfail-run-if "need OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
7 #include "../objc-obj-c++-shared/Object1.h"
8 extern int strcmp(const char *s1, const char *s2);
9 extern void abort(void);
11 #ifdef __NEXT_RUNTIME__
12 #define SUPERCLASS superclass
14 #define SUPERCLASS superClass
17 #define CHECK_IF(expr) if(!(expr)) abort()
19 @interface MyObject: Object
23 @implementation MyObject
24 + (Class)whatever1 { return [super SUPERCLASS]; }
27 @interface MyObject (ThisWontCompile)
31 @implementation MyObject (ThisWontCompile)
32 +(Class)whatever2 { return [super SUPERCLASS]; }
35 int main (int argc, const char * argv[])
37 Class w1 = [MyObject whatever1];
38 Class w2 = [MyObject whatever2];
40 #ifdef NEXT_OBJC_USE_NEW_INTERFACE
41 CHECK_IF(!strcmp( object_getClassName( w1 ), "Object"));
42 CHECK_IF(!strcmp( object_getClassName( w2 ), "Object"));
44 CHECK_IF(!strcmp(w1->name, "Object"));
45 CHECK_IF(!strcmp(w2->name, "Object"));
51 #include "../objc-obj-c++-shared/Object1-implementation.h"