Created on 2007-08-16.00:00:00 last changed 197 months ago
[Voted into the WP at the September, 2008 meeting.]
Proposed Resolution (October, 2007):
Change 9.2.9.3 [dcl.type.simple] paragraph 4 as follows:
The type denoted by decltype(e) is defined as follows:
if e is an id-expression or a class member access (7.6.1.5 [expr.ref]), 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;
otherwise, if e is a function call (7.6.1.3 [expr.call]) or an invocation of an overloaded operator (parentheses around e are ignored), decltype(e) is the return type of
thatthe statically chosen function;otherwise, if e is an lvalue, decltype(e) is T&, where T is the type of e;
otherwise, decltype(e) is the type of e.
The operand of the decltype specifier is an unevaluated operand (Clause 7 [expr]).
[Example:
const int&& foo(); int i; struct A { double x; }; const A* a = new A(); decltype(foo()) x1; // type is const int&& decltype(i) x2; // type is int decltype(a->x) x3; // type is double decltype((a->x)) x4; // type is const double&—end example]
The second bullet of 9.2.9.3 [dcl.type.simple] paragraph 4 reads,
- otherwise, if e is a function call (7.6.1.3 [expr.call]) or an invocation of an overloaded operator (parentheses around e are ignored), decltype(e) is the return type of that function;
The reference to “that function” is imprecise; it is not the actual function called at runtime but the statically chosen function (ignoring covariant return types in virtual functions).
Also, the examples in this paragraph have errors:
The declaration of struct A should end with a semicolon.
The lines of the form decltype(...); are ill-formed; they need a declarator.
History | |||
---|---|---|---|
Date | User | Action | Args |
2008-10-05 00:00:00 | admin | set | messages: + msg1819 |
2008-10-05 00:00:00 | admin | set | status: ready -> cd1 |
2008-06-29 00:00:00 | admin | set | status: review -> ready |
2008-02-03 00:00:00 | admin | set | messages: + msg1579 |
2008-02-03 00:00:00 | admin | set | status: drafting -> review |
2007-10-09 00:00:00 | admin | set | status: open -> drafting |
2007-08-16 00:00:00 | admin | create |