aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2009-09-30 13:56:00 -0400
committerJason Merrill <jason@gcc.gnu.org>2009-09-30 13:56:00 -0400
commit79efe0b3221c95172cf5c8a9c275d9fdcc5047f3 (patch)
tree08cb5e3cc8221234543e6b7a9400a117331ddd81 /gcc
parentc28a9eac6d13773a6637f070244e8adf56ea4ffe (diff)
downloadgcc-79efe0b3221c95172cf5c8a9c275d9fdcc5047f3.zip
gcc-79efe0b3221c95172cf5c8a9c275d9fdcc5047f3.tar.gz
gcc-79efe0b3221c95172cf5c8a9c275d9fdcc5047f3.tar.bz2
* g++.dg/eh/init-temp1.C: Improve test.
From-SVN: r152341
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/eh/init-temp1.C26
2 files changed, 22 insertions, 8 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9c3ca43..61d402a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2009-09-30 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/eh/init-temp1.C: Improve test.
+
2009-09-30 Uros Bizjak <ubizjak@gmail.com>
PR target/22093
diff --git a/gcc/testsuite/g++.dg/eh/init-temp1.C b/gcc/testsuite/g++.dg/eh/init-temp1.C
index 29eae69..529014f 100644
--- a/gcc/testsuite/g++.dg/eh/init-temp1.C
+++ b/gcc/testsuite/g++.dg/eh/init-temp1.C
@@ -1,19 +1,24 @@
// PR c++/15764
+// { dg-do run }
extern "C" void abort ();
-int counter = 0;
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&, a const&) { return 1; }
-
+
+int bs;
+int as_sav;
struct b {
- b (...) { ++counter; }
- ~b () { --counter; }
+ b (...) { ++bs; }
+ ~b () { --bs; as_sav = as; }
};
bool p;
@@ -29,7 +34,12 @@ int main () {
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;
try {
@@ -39,6 +49,6 @@ int main () {
}
catch (...) {}
- if (counter != 0)
+ if (bs != 0)
abort ();
}