2016-12-21 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / objc / execute / root_methods.m
blobe75640ce7c59e697c3b27c3382471c571a803768
1 /* Contributed by Nicola Pero - Thu Mar  8 16:27:46 CET 2001 */
3 #import "../../objc-obj-c++-shared/runtime.h"
4 #import <objc/objc.h>
6 /* Test that instance methods of root classes are available as class 
7    methods to other classes as well */
9 @interface RootClass
11   Class isa;
13 - (id) self;
14 @end
16 @implementation RootClass
17 - (id) self
19   return self;
21 + initialize { return self; }
22 @end
24 @interface NormalClass : RootClass
25 @end
27 @implementation NormalClass : RootClass
28 @end
30 int main (void)
32   Class normal = objc_getClass ("NormalClass");
34   if (normal == Nil)
35     {
36       abort ();
37     }
39   if ([NormalClass self] != normal)
40     {
41       abort ();
42     }
44   return 0;