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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.other/] [init5.C] - Blame information for rev 823

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
// { dg-do run { xfail { ! cxa_atexit } } }
2
// Objects must be destructed in decreasing cnt order
3
// Original test attributed to James Kanze 
4
 
5
extern "C" void abort ();
6
 
7
static int cnt;
8
 
9
class A {
10
  int myCnt;
11
public:
12
  A() : myCnt(cnt++) {}
13
  ~A() { if (--cnt != myCnt) abort(); }
14
};
15
 
16
void f() { static A a; /* a.myCnt == 1 */ }
17
 
18
class B {
19
  int myCnt;
20
public:
21
  B() : myCnt(cnt+1) { f(); ++cnt; }
22
  ~B() { if (--cnt != myCnt) abort(); }
23
};
24
 
25
static A a1; // a1.myCnt == 0
26
static B b1; // b1.myCnt == 2
27
static A a2; // a2.myCnt == 3
28
 
29
int main() {}

powered by: WebSVN 2.1.0

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