https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84030
Bug ID: 84030 Summary: Name lookup in presence of namespace Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: Zahira.Ammarguellat at intel dot com Target Milestone: --- In the code snippet below gcc doesn't give any diagnostics: struct A_ { }; namespace N_ { struct A_ { int g() { return 3; } template<class T> operator T() { return T(); } }; } int main(int argc, char *argv[]) { N_::A_ a; int b = a.operator A_().g(); return b == 3; } gcc seems to be choosing "N_::A_::A_" operator. But in reality there should be ambiguity between that and A::operator? Both clang and MSVC fail to disambiguate it. See https://godbolt.org/#