]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: add test [PR113347]
authorJason Merrill <jason@redhat.com>
Tue, 23 Jan 2024 21:09:15 +0000 (16:09 -0500)
committerJason Merrill <jason@redhat.com>
Wed, 24 Jan 2024 19:42:17 +0000 (14:42 -0500)
The patch for this PR is unneeded on trunk, but let's add the test.

PR c++/113347

gcc/testsuite/ChangeLog:

* g++.dg/eh/return3.C: New test.

gcc/testsuite/g++.dg/eh/return3.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/eh/return3.C b/gcc/testsuite/g++.dg/eh/return3.C
new file mode 100644 (file)
index 0000000..76aa50d
--- /dev/null
@@ -0,0 +1,17 @@
+// PR c++/113347
+
+#if __cplusplus < 201103L
+#define THROWS
+#else
+#define THROWS noexcept(false)
+#endif
+
+struct A { ~A(); };
+struct B { ~B() THROWS; };
+
+A f()
+{
+  A a;
+  return a;
+  B();
+}