c++: Add testcase for PR84494
authorPatrick Palka <ppalka@redhat.com>
Mon, 1 Feb 2021 13:48:46 +0000 (08:48 -0500)
committerPatrick Palka <ppalka@redhat.com>
Mon, 1 Feb 2021 13:48:46 +0000 (08:48 -0500)
We correctly accept this testcase ever since r10-5143.

gcc/testsuite/ChangeLog:

PR c++/84494
* g++.dg/cpp1y/constexpr-84494.C: New test.

gcc/testsuite/g++.dg/cpp1y/constexpr-84494.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-84494.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-84494.C
new file mode 100644 (file)
index 0000000..762cfb4
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/84494
+// { dg-do compile { target c++14 } }
+
+struct X {
+  constexpr X() = default;
+  constexpr X(int x) : m_value(x) {}
+  constexpr X& operator=(const X &o) = default;
+  int m_value {};
+};
+
+static_assert((X() = X(10)).m_value == 10, "");