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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Clang + libc++ also errors: https://godbolt.org/z/oGTh4h6aG


#include <concepts>

template <typename T>
class id {
    T m_id;
public:
    constexpr id() : m_id() {}

    constexpr bool operator==(const id& other) const = default;
zR

    template <std::equality_comparable_with<T> U>
    constexpr bool operator==(const U& other) const { 
        return m_id == other; 
    }
};

struct user_id : public id<int> {};

bool foo(user_id a, user_id b) {
    return a == b;
}

Reply via email to