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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [eh/] [init-temp1.C] - Blame information for rev 307

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

Line No. Rev Author Line
1 301 jeremybenn
// PR c++/15764
2
// { dg-do run }
3
 
4
extern "C" void abort ();
5
 
6
int thrown;
7
 
8
int as;
9
struct a {
10
  a () { ++as; }
11
  ~a () { --as; if (thrown++ == 0) throw 42; }
12
};
13
 
14
int f (a const&) { return 1; }
15
int f (a const&, a const&) { return 1; }
16
 
17
int bs;
18
int as_sav;
19
struct b {
20
  b (...) { ++bs; }
21
  ~b ()   { --bs; as_sav = as; }
22
};
23
 
24
bool p;
25
void g()
26
{
27
  if (p) throw 42;
28
}
29
 
30
int main () {
31
  thrown = 0;
32
  try {
33
    b tmp(f (a(), a()));
34
 
35
    g();
36
  }
37
  catch (...) {}
38
 
39
  // We throw when the first a is destroyed, which should destroy b before
40
  // the other a.
41
  if (as_sav != 1)
42
    abort ();
43
 
44
  thrown = 0;
45
  try {
46
    b tmp(f (a()));
47
 
48
    g();
49
  }
50
  catch (...) {}
51
 
52
  if (bs != 0)
53
    abort ();
54
}

powered by: WebSVN 2.1.0

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