[class] / 2:
The class name is inserted into the area in which it is declared immediately after viewing the class name. The class name is also inserted in the scope of the class itself; this is known as inted-class-name.
those. A::A::A::A refers to A In some contexts, A::A might call the constructor instead, although - [class.qual] / 2 covers this, and its note even refers to your example:
In a search in which function names are not ignored 33 and the naming specifier assigns class C
- if the name specified after the nested qualifier name, when searching in
C , is the name of the introduced class from C (clause 9) or - in the declaration of use (7.3.3), which is a member declaration, if the name specified after the name of the enclosed name, the qualifier matches the identifier or name of the simple-template-id template in the last component of the enclosed name specifier,
the name instead is considered the name of the constructor of class C [Note: For example, the constructor is not an acceptable search result in the specified type specifier, so the constructor will not be used instead of the name of the entered class. - end note]
33) A search that ignores function names, names that appear in a nested qualifier name, qualifier, or base qualifier.
So in a type statement
A::A a;
Function names are not ignored when searching for A::A , and therefore the code is poorly formed because A::A refers to the constructor. However in
struct B : A::A {}; struct A::A a;
Everything is fine, since function names are ignored in database qualifiers and specified type specifiers.
Columbo
source share