]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: add fixed testcase [PR116289]
authorPatrick Palka <ppalka@redhat.com>
Fri, 9 Aug 2024 13:16:45 +0000 (09:16 -0400)
committerPatrick Palka <ppalka@redhat.com>
Fri, 9 Aug 2024 13:16:45 +0000 (09:16 -0400)
Fully fixed since r14-6724-gfced59166f95e9.

PR c++/116289
PR c++/113063

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/spaceship-synth16a.C: New test.

gcc/testsuite/g++.dg/cpp2a/spaceship-synth16a.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-synth16a.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-synth16a.C
new file mode 100644 (file)
index 0000000..68388a6
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/116289
+// PR c++/113063
+// { dg-do link { target c++20 } }
+// A version of spaceship-synth16.C where the local class isn't empty.
+
+#include <compare>
+
+int main() {
+  struct X {
+    int m = 0;
+    auto operator<=>(const X&) const = default;
+  };
+  X x;
+  static_assert(noexcept(x <=> x));
+  x <=> x;
+}