blob: e195a46bf08081c5a8b6fa3bf6f8488687f71ee3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
/* Test class methods inside categories. */
/* Author: Ziemowit Laski <zlaski@apple.com>. */
/* { dg-do run } */
/* { dg-xfail-run-if "need OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
#include "../objc-obj-c++-shared/Object1.h"
extern int strcmp(const char *s1, const char *s2);
extern void abort(void);
#ifdef __NEXT_RUNTIME__
#define SUPERCLASS superclass
#else
#define SUPERCLASS superClass
#endif
#define CHECK_IF(expr) if(!(expr)) abort()
@interface MyObject: Object
+ (Class)whatever1;
@end
@implementation MyObject
+ (Class)whatever1 { return [super SUPERCLASS]; }
@end
@interface MyObject (ThisWontCompile)
+(Class)whatever2;
@end
@implementation MyObject (ThisWontCompile)
+(Class)whatever2 { return [super SUPERCLASS]; }
@end
int main (int argc, const char * argv[])
{
Class w1 = [MyObject whatever1];
Class w2 = [MyObject whatever2];
#ifdef NEXT_OBJC_USE_NEW_INTERFACE
CHECK_IF(!strcmp( object_getClassName( w1 ), "Object"));
CHECK_IF(!strcmp( object_getClassName( w2 ), "Object"));
#else
CHECK_IF(!strcmp(w1->name, "Object"));
CHECK_IF(!strcmp(w2->name, "Object"));
#endif
return 0;
}
#include "../objc-obj-c++-shared/Object1-implementation.h"
|