Debian Codegraph @

gcc/testsuite/objc/execute/no_clash.m

raw
1 /* Contributed by Nicola Pero - Fri Mar 9 19:39:15 CET 2001 */
2 #include "../../objc-obj-c++-shared/TestsuiteObject.m"
3 #import <objc/objc.h>
4
5 /* Test that using the same name for different things makes no
6 problem */
7
8 @interface TestClass : TestsuiteObject
9 {
10 int test;
11 }
12 + (int) test;
13 - (int) test;
14 @end
15
16 @implementation TestClass
17 + (int) test
18 {
19 return 1;
20 }
21 - (int) test
22 {
23 /* 0 + 2 as `test' is implicitly initialized to zero */
24 return test + 2;
25 }
26 @end
27
28
29 int main (void)
30 {
31 if ([TestClass test] != 1)
32 {
33 abort ();
34 }
35 if ([[[TestClass alloc] init] test] != 2)
36 {
37 abort ();
38 }
39
40 return 0;
41 }
42