2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / objc / execute / initialize.m
blob53783982970b3c96f8cec1f4266461aa978e6708
1 /* Contributed by Nicola Pero - Wed Mar  7 17:55:04 CET 2001 */
2 #include <objc/objc.h>
4 /* Test that +initialize is automatically called before the class is
5    accessed */
7 static int class_variable = 0;
9 @interface TestClass
11   Class isa;
13 + (void) initialize;
14 + (int) classVariable;
15 @end
17 @implementation TestClass
18 + (void) initialize
20   class_variable = 1;
22 + (int) classVariable
24   return class_variable;
26 @end
28 int main (void)
30   if ([TestClass classVariable] != 1)
31     {
32       abort ();
33     }
35   return 0;