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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc.dg/] [property/] [at-property-11.m] - Blame information for rev 704

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 704 jeremybenn
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010.  */
2
/* { dg-do run } */
3
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
4
 
5
/* Test that properties are found even if implemented in superclasses.  */
6
 
7
#include <stdlib.h>
8
#include <objc/objc.h>
9
#include <objc/runtime.h>
10
 
11
@interface MyRootClass
12
{
13
  Class isa;
14
  int a;
15
}
16
/* Use the simplest synthesized accessor (assign, nonatomic) as we are
17
   not testing the synthesized accessors in this test, just the
18
   property syntax.  */
19
@property (nonatomic) int a;
20
+ (id) initialize;
21
+ (id) alloc;
22
- (id) init;
23
@end
24
 
25
@implementation MyRootClass
26
+ (id) initialize { return self; }
27
+ (id) alloc { return class_createInstance (self, 0); }
28
- (id) init { return self; }
29
@synthesize a;
30
@end
31
 
32
@interface MySubClass : MyRootClass
33
@end
34
 
35
@implementation MySubClass
36
@end
37
 
38
int main (void)
39
{
40
  MySubClass *object = [[MySubClass alloc] init];
41
 
42
  object.a = 40;
43
  if (object.a != 40)
44
    abort ();
45
 
46
  return 0;
47
}

powered by: WebSVN 2.1.0

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