Envoyé par draft 3090 ¤7.1.6.2 Simple type specifiers
4 The type denoted by decltype(e) is defined as follows:
[1]— if e is an unparenthesized id-expression or a class member access (5.2.5), decltype(e) is the type of the entity named by e. If there is no such entity, or if e names a set of overloaded functions, the program is ill-formed;
[2]— otherwise, if e is a function call (5.2.2) or an invocation of an overloaded operator (parentheses arounde are ignored), decltype(e) is the return type of the statically chosen function;
[3]— otherwise, if e is an lvalue, decltype(e) is T&, where T is the type of e;
[4]— otherwise, decltype(e) is the type of e.
The operand of the decltype specifier is an unevaluated operand (Clause 5).
[ Example:
const int&& foo();
int i;
struct A { double x; };
const A* a = new A();
decltype(foo()) x1 = i; // type is const int&& [5]
decltype(i) x2; // type is int
decltype(a->x) x3; // type is double
decltype((a->x)) x4 = x3; // type is const double& [6]
—end example ]