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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 703 jeremybenn
// Check if ivars may be accessed via the C++ dot notation.
2
// { dg-do run }
3
// { dg-options "-fno-objc-call-cxx-cdtors" }
4
// { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } }
5
 
6
#include "../objc-obj-c++-shared/TestsuiteObject.m"
7
#include 
8
#define CHECK_IF(expr) if(!(expr)) abort()
9
 
10
struct cxx_struct {
11
  int a, b;
12
  void set_values (int _a, int _b = 3) {
13
    a = _a; b = _b;
14
  }
15
  ~cxx_struct (void) {
16
    a = b = 99;
17
  }
18
};
19
 
20
@interface Manip : TestsuiteObject {
21
  int c;
22
  cxx_struct s;   // { dg-warning "user-defined destructor" }
23
                  // { dg-warning "constructors and destructors will not be invoked" "" { target *-*-* } 22 }
24
}
25
- (void) manipulate_ivars;
26
@end
27
 
28
@implementation Manip
29
- (void) manipulate_ivars {
30
  s.set_values (7);
31
  CHECK_IF (s.a == 7 && s.b == 3);
32
  s.~cxx_struct();
33
  CHECK_IF (s.a == 99 && s.b == 99);
34
}
35
@end
36
 
37
int main (void)
38
{
39
  Manip *obj = [Manip new];
40
  [obj manipulate_ivars];
41
  [obj free];
42
}
43
 

powered by: WebSVN 2.1.0

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