1 /* Test class methods inside categories. */
2 /* Author: Ziemowit Laski <zlaski@apple.com>. */
3 /* { dg-options "-lobjc" } */
6 #include <objc/Object.h>
8 #ifdef __NEXT_RUNTIME__
9 #define SUPERCLASS superclass
11 #define SUPERCLASS superClass
14 extern int strcmp(const char *s1, const char *s2);
15 extern void abort(void);
16 #define CHECK_IF(expr) if(!(expr)) abort()
18 @interface MyObject: Object
22 @implementation MyObject
23 + (Class)whatever1 { return [super SUPERCLASS]; }
26 @interface MyObject (ThisWontCompile)
30 @implementation MyObject (ThisWontCompile)
31 +(Class)whatever2 { return [super SUPERCLASS]; }
34 int main (int argc, const char * argv[])
36 Class w1 = [MyObject whatever1];
37 Class w2 = [MyObject whatever2];
39 CHECK_IF(!strcmp(w1->name, "Object"));
40 CHECK_IF(!strcmp(w2->name, "Object"));