https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94227
Bug ID: 94227 Summary: ambiguous lookup for nested-name-specifier in using-declaration is not diagnosed Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: richard-gccbugzilla at metafoo dot co.uk Target Milestone: --- GCC accepts this invalid code: namespace N1 { int &f(); } namespace N2 { struct N1 { float &f(); }; } using namespace N2; int &r = N1::f(); This should be rejected due to ambiguity: the name N1 on the final line is looked up by unqualified lookup, and that lookup is ambiguous between ::N1 and ::N2::N1. But GCC accepts and selects ::N1. (Originally filed as a Clang rejects-valid here: https://llvm.org/PR45216)