https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71882
--- Comment #3 from Stephan Bergmann <sbergman at redhat dot com> --- (In reply to Jonathan Wakely from comment #2) > 10.3.1.2 [namespace.memdef] p3 says "the lookup to determine whether the > entity has been previously declared shall not consider any scopes outside > the innermost enclosing namespace." The struct S is not declared in the > innermost enclosing namespace, but it is visible there, so normal name > lookup would find it. But then this isn't normal name lookup, because it > doesn't keep looking in enclosing namespaces, only the innermost. I guess when I originally filed this bug I interpreted the quoted part of [namespace.memdef] to mean that the lookup is done as per 6.4.1 [basic.lookup.unqual] but ignores scopes *outside* the innermost enclosing namespace, but not scopes *inside* it, like a nested unnamed namespace.