OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [objc/] [execute/] [class_self-1.m] - Blame information for rev 862

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 307 jeremybenn
/* Contributed by Nicola Pero - Fri Oct 26 22:39:32 BST 2001 */
2
#include <objc/objc.h>
3
 
4
/* Test calling a class method when there is an instance method
5
   with conflicting types */
6
 
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
11
{
12
  int a;
13
};
14
 
15
@interface UnusedClass
16
{
17
  Class isa;
18
}
19
- (struct d) method;
20
@end
21
 
22
@implementation UnusedClass
23
- (struct d) method
24
{
25
  struct d u;
26
  u.a = 0;
27
 
28
  return u;
29
}
30
@end
31
 
32
/* The real class */
33
@interface TestClass
34
{
35
  Class isa;
36
}
37
+ (void) test;
38
+ (int) method;
39
@end
40
 
41
@implementation TestClass
42
+ (void) test
43
{
44
  if ([self method] != 4)
45
    {
46
      abort ();
47
    }
48
}
49
 
50
+ (int) method
51
{
52
  return 4;
53
}
54
#ifdef __NEXT_RUNTIME__                                   
55
+ initialize { return self; }
56
#endif
57
@end
58
 
59
 
60
int main (void)
61
{
62
  [TestClass test];
63
 
64
  return 0;
65
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.