[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.3 Qualified names [expr.prim.id.qual]

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 1:

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 a namespace ([basic.namespace]), 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.