https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101945
Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ppalka at gcc dot gnu.org Resolution|--- |DUPLICATE Status|UNCONFIRMED |RESOLVED --- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> --- I think GCC is correct to diagnose the constraint recursion, for similar reasons as for the testcases in PR100288 / PR99599. In order to make your example work, you need to add extra constraints to your overloads. Something like: #include <concepts> template <class T> struct wrapper { using type = T; T value; }; template<class T> constexpr bool is_wrapper_v = false; template<class T> constexpr bool is_wrapper_v<wrapper<T>> = true; template<class T> concept is_wrapper = is_wrapper_v<T>; template <is_wrapper WT, is_wrapper WU, class T = WT::type, class U = WU::type> requires std::equality_comparable_with <T, U> constexpr bool operator == (WT const& a, WU const& b) { return a.value == b.value; } template <is_wrapper WT, class U, class T = WT::type> requires (!is_wrapper<U>) && std::equality_comparable_with <T, U> constexpr bool operator == (WT const& a, U const& b) { return a.value == b; } template <class T, is_wrapper WU, class U = WU::type> requires (!is_wrapper<T>) && std::equality_comparable_with <T, U> constexpr bool operator == (T const& a, WU const& b) { return a == b.value; } constexpr auto a = wrapper <int> { 2 }; constexpr auto b = a; static_assert (a == b); int main () {} *** This bug has been marked as a duplicate of bug 100288 ***