[expr.prim.id.qual] (original) (raw)

7 Expressions [expr]

7.5 Primary expressions [expr.prim]

7.5.4 Names [expr.prim.id]

7.5.4.2 Qualified names [expr.prim.id.qual]

qualified-id: nested-name-specifier template unqualified-id

nested-name-specifier: :: type-name :: namespace-name :: decltype-specifier :: nested-name-specifier identifier :: nested-name-specifier template simple-template-id ::

A nested-name-specifier that denotes a class, optionally followed by the keyword template ([temp.names]), and then followed by the name of a member of either that class ([class.mem]) or one of its base classes, is aqualified-id; [class.qual] describes name lookup for class members that appear in qualified-ids.

The result is the member.

The type of the result is the type of the member.

The result is an lvalue if the member is a static member function or a data member and a prvalue otherwise.

[ Note

:

A class member can be referred to using a qualified-id at any point in its potential scope ([basic.scope.class]).

end note

]

Wheretype-name ​::​~ type-name is used, the two type-names shall refer to the same type (ignoring cv-qualifications); this notation denotes the destructor of the type so named ([expr.prim.id.dtor]).

The nested-name-specifier ​::​ names the global namespace.

A nested-name-specifier that names anamespace, optionally followed by the keywordtemplate ([temp.names]), and then followed by the name of a member of that namespace (or the name of a member of a namespace made visible by ausing-directive), is aqualified-id; [namespace.qual] describes name lookup for namespace members that appear in qualified-ids.

The result is the member.

The type of the result is the type of the member.

The result is an lvalue if the member is a function, a variable, or a structured binding ([dcl.struct.bind]) and a prvalue otherwise.

A nested-name-specifier that denotes anenumeration, followed by the name of an enumerator of that enumeration, is a qualified-idthat refers to the enumerator.

The result is the enumerator.

The type of the result is the type of the enumeration.

The result is a prvalue.

Otherwise, it is looked up in the context in which the entire qualified-id occurs.

In each of these lookups, only names that denote types or templates whose specializations are types are considered.