From: Jakub Jelinek Date: Tue, 13 Apr 2021 18:42:07 +0000 (+0200) Subject: testsuite: Add testcase for already fixed PR97121 X-Git-Tag: basepoints/gcc-12~99 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4df918798b445e86305b63f86f5312a18e4017c5;p=thirdparty%2Fgcc.git testsuite: Add testcase for already fixed PR97121 This was fixed by r11-5866 aka PR96299 fix. 2021-04-13 Jakub Jelinek PR c++/97121 * g++.dg/cpp2a/spaceship-err6.C: New test. --- 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 000000000000..57fbdb330884 --- /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 + +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'" } +}