https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86577
Lénárd Szolnoki <leni536 at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |leni536 at gmail dot com --- Comment #1 from Lénárd Szolnoki <leni536 at gmail dot com> --- Other operators seem to be affected as well. This lookup error can be escalated from accepts-invalid to wrong-code: #include <type_traits> void calls_templated(); void calls_nontemplated(); namespace a { struct A {}; } namespace { template<typename T> std::enable_if_t<std::is_same_v<T, a::A>, bool> operator==(const T&, const T &) { calls_templated(); return true; } template<typename T> bool test(const T&t1, const T &t2) { return t1==t2; } bool operator==(const a::A&, const a::A&) { calls_nontemplated(); return true; } } int main() { const a::A a; test(a, a); } gcc 10.1 compiles the code above and calls 'calls_nontemplated()'.