aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2021-04-13 20:42:07 +0200
committerJakub Jelinek <jakub@redhat.com>2021-04-13 20:42:07 +0200
commit4df918798b445e86305b63f86f5312a18e4017c5 (patch)
treebdf33b45510f69e6c73fc80fbb90d2e628702bff
parent6173f713a35d5450f0e2acfdaec695b42632aeed (diff)
downloadgcc-4df918798b445e86305b63f86f5312a18e4017c5.zip
gcc-4df918798b445e86305b63f86f5312a18e4017c5.tar.gz
gcc-4df918798b445e86305b63f86f5312a18e4017c5.tar.bz2
testsuite: Add testcase for already fixed PR97121
This was fixed by r11-5866 aka PR96299 fix. 2021-04-13 Jakub Jelinek <jakub@redhat.com> PR c++/97121 * g++.dg/cpp2a/spaceship-err6.C: New test.
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/spaceship-err6.C20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-err6.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-err6.C
new file mode 100644
index 0000000..57fbdb33
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-err6.C
@@ -0,0 +1,20 @@
+// PR c++/97121
+// { dg-do compile { target c++20 } }
+
+#include <compare>
+
+class MyClass
+{
+ int mValue; // { dg-error "three-way comparison of 'MyClass::mValue' has type 'std::strong_ordering', which does not convert to 'bool'" }
+
+public:
+ MyClass(int value): mValue(value) {}
+
+ bool operator<=>(const MyClass&) const = default;
+};
+
+int main()
+{
+ MyClass a = 10, b = 15;
+ return (a < b); // { dg-error "use of deleted function 'constexpr bool MyClass::operator<=>\\\(const MyClass&\\\) const'" }
+}