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-1.mm] - Blame information for rev 820

Go to most recent revision | 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 the 'dot syntax' without a declarated property.  */
6
 
7
#include 
8
#include 
9
#include 
10
 
11
@interface MyRootClass
12
{
13
  Class isa;
14
  int a;
15
  id b;
16
}
17
+ (id) initialize;
18
+ (id) alloc;
19
- (id) init;
20
- (int) count;
21
- (void) setCount: (int)value;
22
- (id) next;
23
- (void) setNext: (id)value;
24
@end
25
 
26
@implementation MyRootClass
27
+ (id) initialize { return self; }
28
+ (id) alloc { return class_createInstance (self, 0); }
29
- (id) init { return self; }
30
- (int) count
31
{
32
  return a;
33
}
34
- (void) setCount: (int)value
35
{
36
  a = value;
37
}
38
- (id) next
39
{
40
  return b;
41
}
42
- (void) setNext: (id)value
43
{
44
  b = value;
45
}
46
@end
47
 
48
int main (void)
49
{
50
  MyRootClass *object = [[MyRootClass alloc] init];
51
 
52
  object.count = 40;
53
  if (object.count != 40)
54
    abort ();
55
 
56
  object.next = object;
57
  if (object.next != object)
58
    abort ();
59
 
60
  return 0;
61
}
62
 
63
 

powered by: WebSVN 2.1.0

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