| 1 | // RUN: %check_clang_tidy -std=c++20 %s readability-implicit-bool-conversion %t |
| 2 | |
| 3 | namespace std { |
| 4 | struct strong_ordering { |
| 5 | int n; |
| 6 | constexpr operator int() const { return n; } |
| 7 | static const strong_ordering equal, greater, less; |
| 8 | }; |
| 9 | constexpr strong_ordering strong_ordering::equal = {.n: 0}; |
| 10 | constexpr strong_ordering strong_ordering::greater = {.n: 1}; |
| 11 | constexpr strong_ordering strong_ordering::less = {.n: -1}; |
| 12 | } // namespace std |
| 13 | |
| 14 | namespace PR93409 { |
| 15 | struct X |
| 16 | { |
| 17 | auto operator<=>(const X&) const = default; |
| 18 | bool m_b; |
| 19 | }; |
| 20 | |
| 21 | struct Y |
| 22 | { |
| 23 | auto operator<=>(const Y&) const = default; |
| 24 | X m_x; |
| 25 | }; |
| 26 | |
| 27 | bool compare(const Y& y1, const Y& y2) |
| 28 | { |
| 29 | return y1 == y2 || y1 < y2 || y1 > y2; |
| 30 | } |
| 31 | } |
| 32 | |