[C++11: 7.1.6.2/4]:
The type denoted bydecltype(e)
is defined as follows:
- if
e
is an unparenthesized id-expression or an unparenthesized class member access (5.2.5),decltype(e)
is the type of the entity named bye
. If there is no such entity, or ife
names a set of overloaded functions, the program is ill-formed;- otherwise, if
e
is an xvalue,decltype(e)
isT&&
, whereT
is the type ofe
;- otherwise, if
e
is an lvalue,decltype(e)
isT&
, whereT
is the type ofe
;- otherwise,
decltype(e)
is the type ofe
.The operand of the
decltype
specifier is an unevaluated operand (Clause 5).
The second, third and fourth cases clearly refer to the type of the expression, which would not include any polymorphism considerations.
However, and I'm not entirely sure what "entity" means here, the first case appears to be naming the object refered to by the expression e
. It is ambiguous to me as to whether "the type of the entity" means its runtime type, or its static type.