brintos

brintos / llvm-project-archived public Read only

0
0
Text · 712 B · 13aa5c5 Raw
32 lines · cpp
1// RUN: %check_clang_tidy -std=c++20 %s readability-implicit-bool-conversion %t2 3namespace std {4struct strong_ordering {5  int n;6  constexpr operator int() const { return n; }7  static const strong_ordering equal, greater, less;8};9constexpr strong_ordering strong_ordering::equal = {0};10constexpr strong_ordering strong_ordering::greater = {1};11constexpr strong_ordering strong_ordering::less = {-1};12} // namespace std13 14namespace PR93409 {15  struct X16  {17      auto operator<=>(const X&) const = default;18      bool m_b;19  };20 21  struct Y22  {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