aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2020-10-23 15:03:38 +0100
committerJonathan Wakely <jwakely@redhat.com>2020-10-23 15:03:38 +0100
commitb66b30a807918ee1cf89b3376bb410b9046639b8 (patch)
tree77dd2f334e1c360895cacc35ef91ceb6828016a5
parent50106208ff65fe8076329169cd97460a03e27388 (diff)
downloadgcc-b66b30a807918ee1cf89b3376bb410b9046639b8.zip
gcc-b66b30a807918ee1cf89b3376bb410b9046639b8.tar.gz
gcc-b66b30a807918ee1cf89b3376bb410b9046639b8.tar.bz2
testsuite: Add noexcept(false) to throwing destructor
I think this test is intended to check this property of the C++ standard: "If a destructor directly invoked by stack unwinding exits via an exception, std::terminate is invoked." [except.throw] Since C++11 any exception escaping a destructor will call std::terminate, so the test would terminate even if the unwinding behaviour was wrong. Give the destructor a potentially-throwing exception specification, so that we know that terminate was called for the right reason. gcc/testsuite/ChangeLog: * g++.dg/compat/eh/filter2_y.C: Add noexcept(false) to destructor.
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/filter2_y.C6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/compat/eh/filter2_y.C b/gcc/testsuite/g++.dg/compat/eh/filter2_y.C
index 87c6fea..67a4ffe 100644
--- a/gcc/testsuite/g++.dg/compat/eh/filter2_y.C
+++ b/gcc/testsuite/g++.dg/compat/eh/filter2_y.C
@@ -9,6 +9,12 @@ struct a
a () { }
~a ()
+#if __cplusplus >= 201103L
+ // Give this destructor a potentially-throwing exception specification so
+ // that we verify std::terminate gets called due to an exception during
+ // unwinding, not just because the destructor is noexcept.
+ noexcept(false)
+#endif
{
try
{