| 1 |
/* Check that the '-fzero-link' flag doesn't prevent messaging from working. */ |
| 2 |
/* Contributed by Ziemowit Laski <[email protected]>. */ |
| 3 |
|
| 4 |
/* { dg-do run { target *-*-darwin* } } */ |
| 5 |
/* { dg-additional-options "-fzero-link" } */ |
| 6 |
/* { dg-additional-options "-framework Foundation" { target { *-*-darwin* } } } */ |
| 7 |
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ |
| 8 |
|
| 9 |
#ifdef __NEXT_RUNTIME__ |
| 10 |
# include "../objc-obj-c++-shared/F-NSObject.h" |
| 11 |
# define OBJECT NSObject |
| 12 |
#else |
| 13 |
# include <objc/Object.h> |
| 14 |
# include <objc/Protocol.h> |
| 15 |
# define OBJECT Object |
| 16 |
#endif |
| 17 |
|
| 18 |
extern void abort(void); |
| 19 |
#define CHECK_IF(expr) if(!(expr)) abort(); |
| 20 |
|
| 21 |
@interface Base: OBJECT |
| 22 |
+ (int) getValue; |
| 23 |
@end |
| 24 |
|
| 25 |
@implementation Base |
| 26 |
+ (int) getValue { return 1593; } |
| 27 |
@end |
| 28 |
|
| 29 |
int main(void) { |
| 30 |
int val = [Base getValue]; |
| 31 |
CHECK_IF(val == 1593); |
| 32 |
return 0; |
| 33 |
} |
| 34 |
|