aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2002-03-30 18:56:34 -0800
committerRichard Henderson <rth@gcc.gnu.org>2002-03-30 18:56:34 -0800
commitafaef726703929d7bb53a9e32d6ab61ad3ae56d7 (patch)
tree90cff28282aff9e481151ddefc4808ecd0a2226d /gcc
parent606cc0562db3ee50a1e6182fe748d092f9417b5a (diff)
downloadgcc-afaef726703929d7bb53a9e32d6ab61ad3ae56d7.zip
gcc-afaef726703929d7bb53a9e32d6ab61ad3ae56d7.tar.gz
gcc-afaef726703929d7bb53a9e32d6ab61ad3ae56d7.tar.bz2
re PR c++/3719 (Unable to retrow exception in unexpected exception handler.)
PR c++/3719 * libsupc++/eh_personality.cc (__cxa_call_unexpected): Copy handler data out of the exception struct before calling unexpectedHandler. * g++.dg/eh/unexpected1.C: New. From-SVN: r51623
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/g++.dg/eh/unexpected1.C46
1 files changed, 46 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/eh/unexpected1.C b/gcc/testsuite/g++.dg/eh/unexpected1.C
new file mode 100644
index 0000000..26a5848
--- /dev/null
+++ b/gcc/testsuite/g++.dg/eh/unexpected1.C
@@ -0,0 +1,46 @@
+// PR 3719
+// Test that an unexpected handler can rethrow to categorize.
+// { dg-do run }
+
+#include <exception>
+
+extern "C" void abort ();
+
+struct One { };
+struct Two { };
+
+static void
+handle_unexpected ()
+{
+ try
+ {
+ throw;
+ }
+ catch (One &)
+ {
+ throw Two ();
+ }
+}
+
+static void
+doit () throw (Two)
+{
+ throw One ();
+}
+
+main ()
+{
+ std::set_unexpected (handle_unexpected);
+
+ try
+ {
+ doit ();
+ }
+ catch (Two &)
+ {
+ }
+ catch (...)
+ {
+ abort ();
+ }
+}