6 Basic concepts [basic]

6.4 Name lookup [basic.lookup]

6.4.3 Qualified name lookup [basic.lookup.qual]

6.4.3.1 Class members [class.qual]

If the nested-name-specifier of a qualified-id nominates a class, the name specified after the nested-name-specifier is looked up in the scope of the class ([class.member.lookup]), except for the cases listed below.
The name shall represent one or more members of that class or of one of its base classes (Clause [class.derived]).
[Note
:
A class member can be referred to using a qualified-id at any point in its potential scope ([basic.scope.class]).
end note
]
The exceptions to the name lookup rule above are the following:
In a lookup in which function names are not ignored34 and the nested-name-specifier nominates a class C: the name is instead considered to name the constructor of class C.
[Note
:
For example, the constructor is not an acceptable lookup result in an elaborated-type-specifier so the constructor would not be used in place of the injected-class-name.
end note
]
Such a constructor name shall be used only in the declarator-id of a declaration that names a constructor or in a using-declaration.
[Example
:
struct A { A(); };
struct B: public A { B(); };

A::A() { }
B::B() { }

B::A ba;            // object of type A
A::A a;             // error, A​::​A is not a type name
struct A::A a2;     // object of type A
end example
]
A class member name hidden by a name in a nested declarative region or by the name of a derived class member can still be found if qualified by the name of its class followed by the ​::​ operator.
Lookups in which function names are ignored include names appearing in a nested-name-specifier, an elaborated-type-specifier, or a base-specifier.