Commit 79efe0b3 by Jason Merrill Committed by Jason Merrill

* g++.dg/eh/init-temp1.C: Improve test.

From-SVN: r152341
parent c28a9eac
2009-09-30 Jason Merrill <jason@redhat.com>
* g++.dg/eh/init-temp1.C: Improve test.
2009-09-30 Uros Bizjak <ubizjak@gmail.com> 2009-09-30 Uros Bizjak <ubizjak@gmail.com>
PR target/22093 PR target/22093
......
// PR c++/15764 // PR c++/15764
// { dg-do run }
extern "C" void abort (); extern "C" void abort ();
int counter = 0;
int thrown; int thrown;
struct a {
~a () { if (thrown++ == 0) throw 42; } int as;
struct a {
a () { ++as; }
~a () { --as; if (thrown++ == 0) throw 42; }
}; };
int f (a const&) { return 1; } int f (a const&) { return 1; }
int f (a const&, a const&) { return 1; } int f (a const&, a const&) { return 1; }
int bs;
int as_sav;
struct b { struct b {
b (...) { ++counter; } b (...) { ++bs; }
~b () { --counter; } ~b () { --bs; as_sav = as; }
}; };
bool p; bool p;
...@@ -29,7 +34,12 @@ int main () { ...@@ -29,7 +34,12 @@ int main () {
g(); g();
} }
catch (...) {} catch (...) {}
// We throw when the first a is destroyed, which should destroy b before
// the other a.
if (as_sav != 1)
abort ();
thrown = 0; thrown = 0;
try { try {
...@@ -39,6 +49,6 @@ int main () { ...@@ -39,6 +49,6 @@ int main () {
} }
catch (...) {} catch (...) {}
if (counter != 0) if (bs != 0)
abort (); abort ();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment