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

--- Comment #21 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Here's a very small reproducer:

template<typename T> struct indirect {
  template<typename U> requires // (!is_indirect<U>) &&
    requires (const T& t, const U& u) { t == u; }
  friend constexpr bool operator==(const indirect&, const U&)
  { return false; }

  T* _M_ptr{};
};

indirect<int> i;
bool b = i == 1;


It compiles with trunk, although my real case that this was reduced from
doesn't.

It works if you uncomment the extra constraint and define:

template<typename T> class indirect;
template<typename T> constexpr bool is_indirect = false;
template<typename T> constexpr bool is_indirect<indirect<T>> = true;

Reply via email to