diff mbox series

testsuite: Add testcase for already fixed PR97121

Message ID 20210413184433.GM1179226@tucnak
State New
Headers show
Series testsuite: Add testcase for already fixed PR97121 | expand

Commit Message

Jakub Jelinek April 13, 2021, 6:44 p.m. UTC
Hi!

This was fixed by r11-5866 aka PR96299 fix.
This just adds a testcase for it into the testsuite, tested
on x86_64-linux -m32/-m64, committed to trunk.

2021-04-13  Jakub Jelinek  <jakub@redhat.com>

	PR c++/97121
	* g++.dg/cpp2a/spaceship-err6.C: New test.


	Jakub
diff mbox series

Patch

--- gcc/testsuite/g++.dg/cpp2a/spaceship-err6.C.jj	2021-04-13 20:33:40.206442108 +0200
+++ gcc/testsuite/g++.dg/cpp2a/spaceship-err6.C	2021-04-13 20:38:23.740283353 +0200
@@ -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'" }
+}