diff options
Diffstat (limited to 'gcc/testsuite/objc/execute/load.m')
-rw-r--r-- | gcc/testsuite/objc/execute/load.m | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/objc/execute/load.m b/gcc/testsuite/objc/execute/load.m new file mode 100644 index 000000000..fad662384 --- /dev/null +++ b/gcc/testsuite/objc/execute/load.m @@ -0,0 +1,30 @@ +/* Contributed by Nicola Pero - Wed Mar 7 17:55:04 CET 2001 */ +#include <objc/objc.h> + +/* Test that +load is automatically called before main is run */ + +static int static_variable = 0; + +@interface TestClass +{ + Class isa; +} ++ (void) load; +@end + +@implementation TestClass ++ (void) load +{ + static_variable = 1; +} +@end + +int main (void) +{ + if (static_variable != 1) + { + abort (); + } + + return 0; +} |