OSDN Git Service

New testcases
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / objc / execute / root_methods.m
1 /* Contributed by Nicola Pero - Thu Mar  8 16:27:46 CET 2001 */
2 #include <objc/objc.h>
3
4 #include "next_mapping.h"
5
6 /* Test that instance methods of root classes are available as class 
7    methods to other classes as well */
8
9 @interface RootClass
10 {
11   Class isa;
12 }
13 - (id) self;
14 @end
15
16 @implementation RootClass
17 - (id) self
18 {
19   return self;
20 }
21 #ifdef __NEXT_RUNTIME__                                   
22 + initialize { return self; }
23 #endif
24 @end
25
26 @interface NormalClass : RootClass
27 @end
28
29 @implementation NormalClass : RootClass
30 @end
31
32 int main (void)
33 {
34   Class normal = objc_get_class ("NormalClass");
35
36   if (normal == Nil)
37     {
38       abort ();
39     }
40
41   if ([NormalClass self] != normal)
42     {
43       abort ();
44     }
45
46   return 0;
47 }