https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107652
Bug ID: 107652 Summary: c++20 gccchoses incorrect operator== overload Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: tiagomacarios at gmail dot com Target Milestone: --- In C++20 gcc will chose the incorrect overload for this code. The overload should be ambiguous (see msvc). https://godbolt.org/z/rox1z1Txa ``` namespace N { struct C; struct B; struct A { bool fun(A, B, C); bool operator==(A const&) const; bool operator!=(A const&) const; }; struct B : A {}; struct C : A { bool operator==(C const&) const; bool operator!=(C const&) const; C(const B&); }; } // namespace N namespace N { bool A::fun(A a, B b, C c) { return b == c; } } // namespace N ```