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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [obj-c++.dg/] [property/] [dotsyntax-10.mm] - Blame information for rev 703

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 703 jeremybenn
/* Contributed by Nicola Pero , November 2010.  */
2
/* { dg-do run } */
3
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
4
 
5
/* Test dot-syntax with 'super'.  */
6
 
7
#include 
8
#include 
9
#include 
10
 
11
static int c;
12
 
13
@interface MyRootClass
14
{
15
  Class isa;
16
  int a;
17
}
18
+ (id) initialize;
19
+ (id) alloc;
20
- (id) init;
21
- (int) count;
22
- (void) setCount: (int)count;
23
+ (int) classCount;
24
+ (void) setClassCount: (int)count;
25
@end
26
 
27
@implementation MyRootClass
28
+ (id) initialize { return self; }
29
+ (id) alloc { return class_createInstance (self, 0); }
30
- (id) init { return self; }
31
- (int) count
32
{
33
  return a;
34
}
35
- (void) setCount: (int)count
36
{
37
  a = count;
38
}
39
+ (int) classCount
40
{
41
  return c;
42
}
43
+ (void) setClassCount: (int)count
44
{
45
  c = count;
46
}
47
@end
48
 
49
@interface MySubClass : MyRootClass
50
+ (int) testMe;
51
- (int) testMe;
52
@end
53
 
54
@implementation MySubClass
55
- (int) testMe
56
{
57
  super.count = 400;
58
  if (super.count != 400)
59
    abort ();
60
 
61
  return super.count;
62
}
63
+ (int) testMe
64
{
65
  super.classCount = 4000;
66
  if (super.classCount != 4000)
67
    abort ();
68
 
69
  return super.classCount;
70
}
71
@end
72
 
73
int main (void)
74
{
75
  MySubClass *object = [[MySubClass alloc] init];
76
 
77
  if ([object testMe] != 400)
78
    abort ();
79
 
80
  if ([MySubClass testMe] != 4000)
81
    abort ();
82
 
83
  return 0;
84
}
85
 
86
 

powered by: WebSVN 2.1.0

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