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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [obj-c++.dg/] [cxx-scope-1.mm] - Blame information for rev 703

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 703 jeremybenn
/* Handle C++ scoping ('::') operators in ObjC message receivers gracefully.  */
2
/* Author: Ziemowit Laski   */
3
 
4
/* { dg-do run } */
5
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
6
#include "../objc-obj-c++-shared/TestsuiteObject.m"
7
#include 
8
 
9
@class Derived;
10
 
11
Derived *inst[3];
12
 
13
struct CxxClass {
14
  static Derived *get_instance(int);
15
};
16
 
17
Derived *CxxClass::get_instance(int offs) {
18
  return inst[offs];
19
}
20
 
21
@interface Derived: TestsuiteObject {
22
  int value;
23
}
24
-(id)initWithValue:(int)val;
25
-(int)derived_meth;
26
@end
27
 
28
@implementation Derived
29
-(id)initWithValue:(int)val {
30
  [super init];
31
  value = val;
32
  return self;
33
}
34
- (int)derived_meth {
35
  return value;
36
}
37
@end
38
 
39
int main(void) {
40
  int r;
41
  inst[1] = [[::Derived alloc] initWithValue:7];
42
  inst[2] = [[Derived alloc] initWithValue:77];
43
 
44
  r = [CxxClass::get_instance(2) derived_meth];
45
  if (r != 77)
46
    abort();
47
 
48
  r = [CxxClass::get_instance(1) derived_meth];
49
  if (r != 7)
50
    abort();
51
 
52
  return 0;
53
}
54
 

powered by: WebSVN 2.1.0

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