1 // PR c++/97121 2 // { dg-do compile { target c++20 } } 3 4 #include <compare> 5 6 class MyClass 7 { 8 int mValue; // { dg-error "three-way comparison of 'MyClass::mValue' has type 'std::strong_ordering', which does not convert to 'bool'" } 9 10 public: MyClass(int value)11 MyClass(int value): mValue(value) {} 12 13 bool operator<=>(const MyClass&) const = default; 14 }; 15 main()16int main() 17 { 18 MyClass a = 10, b = 15; 19 return (a < b); // { dg-error "use of deleted function 'constexpr bool MyClass::operator<=>\\\(const MyClass&\\\) const'" } 20 } 21