Dead
[official-gcc.git] / gomp-20050608-branch / gcc / testsuite / objc / execute / class_self-1.m
blob1690f8f6bbc3f06db27e82f569441a5c85a3ae45
1 /* Contributed by Nicola Pero - Fri Oct 26 22:39:32 BST 2001 */
2 #include <objc/objc.h>
4 /* Test calling a class method when there is an instance method 
5    with conflicting types */
7 /* This class should be unused but on broken compilers its instance
8    method might get picked up and used instead of the class method of
9    another class ! */
10 struct d
12   int a;
15 @interface UnusedClass
17   Class isa;
19 - (struct d) method;
20 @end
22 @implementation UnusedClass
23 - (struct d) method
25   struct d u;
26   u.a = 0;
27   
28   return u;
30 @end
32 /* The real class */
33 @interface TestClass
35   Class isa;
37 + (void) test;
38 + (int) method;
39 @end
41 @implementation TestClass
42 + (void) test
44   if ([self method] != 4)
45     {
46       abort ();
47     }
50 + (int) method
52   return 4;
54 #ifdef __NEXT_RUNTIME__                                   
55 + initialize { return self; }
56 #endif
57 @end
60 int main (void)
62   [TestClass test];
64   return 0;