| 1 |
/* Test class methods inside categories. */ |
| 2 |
/* Author: Ziemowit Laski <[email protected]>. */ |
| 3 |
|
| 4 |
/* { dg-do run } */ |
| 5 |
/* { dg-xfail-run-if "need OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ |
| 6 |
|
| 7 |
#include "../objc-obj-c++-shared/TestsuiteObject.m" |
| 8 |
extern int strcmp(const char *s1, const char *s2); |
| 9 |
extern void abort(void); |
| 10 |
|
| 11 |
#define CHECK_IF(expr) if(!(expr)) abort() |
| 12 |
|
| 13 |
@interface MyObject: TestsuiteObject |
| 14 |
+ (Class)whatever1; |
| 15 |
@end |
| 16 |
|
| 17 |
@implementation MyObject |
| 18 |
+ (Class)whatever1 { return [super superclass]; } |
| 19 |
@end |
| 20 |
|
| 21 |
@interface MyObject (ThisWontCompile) |
| 22 |
+(Class)whatever2; |
| 23 |
@end |
| 24 |
|
| 25 |
@implementation MyObject (ThisWontCompile) |
| 26 |
+(Class)whatever2 { return [super superclass]; } |
| 27 |
@end |
| 28 |
|
| 29 |
int main (int argc, const char * argv[]) |
| 30 |
{ |
| 31 |
Class w1 = [MyObject whatever1]; |
| 32 |
Class w2 = [MyObject whatever2]; |
| 33 |
|
| 34 |
CHECK_IF(!strcmp( object_getClassName( w1 ), "TestsuiteObject")); |
| 35 |
CHECK_IF(!strcmp( object_getClassName( w2 ), "TestsuiteObject")); |
| 36 |
|
| 37 |
return 0; |
| 38 |
} |
| 39 |
|