From 4df918798b445e86305b63f86f5312a18e4017c5 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek <jakub@redhat.com> Date: Tue, 13 Apr 2021 20:42:07 +0200 Subject: [PATCH] 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. --- gcc/testsuite/g++.dg/cpp2a/spaceship-err6.C | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/spaceship-err6.C 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 <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'" } +} -- GitLab