https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100903

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It could also help to overload the comparison operators with constrained
deleted overloads, like so:

    template<typename _Tp>
      concept __not_literal_zero = !convertible_to<_Tp, __unspec>;

    friend constexpr bool
    operator==(partial_ordering, __cmp_cat::__not_literal_zero auto) = delete;

    friend constexpr void
    operator<=>(partial_ordering, __cmp_cat::__not_literal_zero auto) = delete;


With that the "no match for 'operator<'" error  (and its eight accompanying
notes) become:


cmp.cc:7:15: error: use of deleted function 'constexpr void
std::operator<=>(partial_ordering, auto:3) [with auto:3 = long int;
partial_ordering = partial_ordering]'
    7 |   return po > 0L;
      |               ^~
/home/jwakely/gcc/14/include/c++/14.0.0/compare:160:5: note: declared here
  160 |     operator<=>(partial_ordering, __cmp_cat::__not_literal_zero auto) =
delete;
      |     ^~~~~~~~

Reply via email to