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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 703 jeremybenn
/* Contributed by Nicola Pero , October 2010.  */
2
/* { dg-do run } */
3
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
4
 
5
#include 
6
#include 
7
#include 
8
 
9
@interface MyRootClass
10
{
11
  Class isa;
12
}
13
+ (id) initialize;
14
+ (id) alloc;
15
- (id) init;
16
@end
17
 
18
@implementation MyRootClass
19
+ (id) initialize { return self; }
20
+ (id) alloc { return class_createInstance (self, 0); }
21
- (id) init { return self; }
22
@end
23
 
24
@interface Test : MyRootClass
25
{
26
  int v1;
27
}
28
@property int v1;
29
/* TODO: Test more types of properties with different semantics
30
   (retain, copy, atomic, nonatomic, and test various C and
31
   Objective-C types).  */
32
@end
33
 
34
@implementation Test
35
@synthesize v1;
36
@end
37
 
38
int main ()
39
{
40
  Test *object = [[Test alloc] init];
41
 
42
  /* Check that the synthesized methods exist and work.  Do not invoke
43
     them via property syntax - that is another test.  Here we just
44
     want to test the synthesis of the methods.  */
45
  [object setV1: 400];
46
 
47
  if ([object v1] != 400)
48
    abort ();
49
 
50
  return (0);
51
}
52
 

powered by: WebSVN 2.1.0

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