]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: add fixed test [PR94231]
authorMarek Polacek <polacek@redhat.com>
Tue, 6 Feb 2024 16:44:44 +0000 (11:44 -0500)
committerMarek Polacek <polacek@redhat.com>
Tue, 6 Feb 2024 16:48:05 +0000 (11:48 -0500)
I was suprised to find out that r14-8759 fixed this accepts-invalid.

clang version 17.0.6 rejects the test as well; clang version 19.0.0git
crashes for which I opened
<https://github.com/llvm/llvm-project/issues/80869>.

PR c++/94231

gcc/testsuite/ChangeLog:

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

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

diff --git a/gcc/testsuite/g++.dg/cpp0x/deleted17.C b/gcc/testsuite/g++.dg/cpp0x/deleted17.C
new file mode 100644 (file)
index 0000000..3bebe88
--- /dev/null
@@ -0,0 +1,20 @@
+// PR c++/94231
+// { dg-do compile { target c++11 } }
+
+struct F {F(F&&)=delete;};
+
+template<int=0>
+struct M {
+  F f;
+  M();
+  M(const M&);
+  M(M&&);
+};
+
+template<int I>
+M<I>::M(M&&)=default; // { dg-error "use of deleted function" }
+
+M<> f() {
+  M<> m;
+  return m;
+}