问题
Sec. 3.4.3/3 said:
In a declaration in which the declarator-id is a qualified-id, names used before the qualified-id being declared are looked up in the defining namespace scope; names following the qualified-id are looked up in the scope of the member’s class or namespace.
There is a code example from 3.4.3/3 N3797:
class X { };
class C {
    class X { };
    static const int number = 50;
    static X arr[number];
};
X C::arr[number];// ill-formed:
                 // equivalent to: ::X C::arr[__C::number__];
                 // not to: C::X C::arr[__C::number__];
But I think that it is not true because unqualified name used in the X C::arr[number] can be found in the enclosing scope, but the X C::arr[C::number] is not searching the number in the enclosing scopes. Is it a typo?
回答1:
As far as I can tell example is correct and follows directly from the the paragraph before the example:
In a declaration in which the declarator-id is a qualified-id, names used before the qualified-id being declared are looked up in the defining namespace scope;
So the X found will be ::X and not C::X since it is before the qualified-id
and:
names following the qualified-id are looked up in the scope of the member’s class or namespace
So number will be C::number since it is after the qualified-id.
来源:https://stackoverflow.com/questions/24104101/name-lookup-after-qualified-declarator-id