c++: Add fixed test [PR70077]
authorMarek Polacek <polacek@redhat.com>
Wed, 23 Feb 2022 17:37:43 +0000 (12:37 -0500)
committerMarek Polacek <polacek@redhat.com>
Wed, 23 Feb 2022 17:38:02 +0000 (12:38 -0500)
Fixed with r10-1280.

PR c++/70077

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/noexcept76.C: New test.

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

diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept76.C b/gcc/testsuite/g++.dg/cpp0x/noexcept76.C
new file mode 100644 (file)
index 0000000..fc81647
--- /dev/null
@@ -0,0 +1,17 @@
+// PR c++/70077
+// { dg-do compile { target c++11 } }
+
+struct B {
+    B(int) noexcept { }
+    virtual void f() = 0;
+};
+
+struct D: public B {
+    using B::B;
+    D() noexcept(noexcept(D{42})): B{42} { }
+    void f() override { }
+};
+
+int main() {
+    B *b = new D{};
+}