[temp.dep.expr] (original) (raw)
13 Templates [temp]
13.8 Name resolution [temp.res]
13.8.2 Dependent names [temp.dep]
13.8.2.2 Type-dependent expressions [temp.dep.expr]
Except as described below, an expression is type-dependent if any subexpression is type-dependent.
thisis type-dependent if the class type of the enclosing member function is dependent ([temp.dep.type]).
Anid-expressionis type-dependent if it is not a concept-id and it contains
- anidentifierassociated by name lookup with one or more declarations declared with a dependent type,
- anidentifierassociated by name lookup with a non-type template-parameterdeclared with a type that contains a placeholder type,
- anidentifierassociated by name lookup with a variable declared with a type that contains a placeholder type ([dcl.spec.auto]) where the initializer is type-dependent,
- an identifier associated by name lookup with one or more declarations of member functions of the current instantiation declared with a return type that contains a placeholder type,
- an identifier associated by name lookup with a structured binding declaration whosebrace-or-equal-initializer is type-dependent,
- theidentifier __func__ ([dcl.fct.def.general]), where any enclosing function is a template, a member of a class template, or a generic lambda,
- atemplate-idthat is dependent,
- aconversion-function-idthat specifies a dependent type, or
- anested-name-specifieror aqualified-idthat names a member of an unknown specialization;
or if it names a dependent member of the current instantiation that is a static data member of type “array of unknown bound of T” for some T ([temp.static]).
Expressions of the following forms are type-dependent only if the type specified by thetype-id,simple-type-specifierornew-type-idis dependent, even if any subexpression is type-dependent:
simple-type-specifier ( expression-list ) :: new new-placement new-type-id new-initializer :: new new-placement ( type-id ) new-initializer dynamic_cast < type-id > ( expression ) static_cast < type-id > ( expression ) const_cast < type-id > ( expression ) reinterpret_cast < type-id > ( expression ) ( type-id ) cast-expression
A class member access expression is type-dependent if the expression refers to a member of the current instantiation and the type of the referenced member is dependent, or the class member access expression refers to a member of an unknown specialization.
[ Note
:
In an expression of the formx.yorxp->ythe type of the expression is usually the type of the memberyof the class ofx(or the class pointed to byxp).
However, ifxorxprefers to a dependent type that is not the current instantiation, the type ofyis always dependent.
Ifxor xprefers to a non-dependent type or refers to the current instantiation, the type ofyis the type of the class member access expression.
— end note
]
A braced-init-list is type-dependent if any element is type-dependent or is a pack expansion.