Created on 2014-06-30.00:00:00 last changed 94 months ago
[Moved to DR at the May, 2015 meeting.]
Proposed resolution (April, 2015):
Change 9.2.9.7 [dcl.spec.auto] paragraph 7 as follows:
...If the placeholder is the decltype(auto) type-specifier, the declared type of the variable or return type of the function shall be the placeholder alone. The type deduced for the variable or return type is determined as described in 9.2.9.3 [dcl.type.simple], as though theinitializerinitializer-clause or expression-list of the initializer or the expression of the return statement had been the operand of the decltype. [Example:int i; int&& f(); auto x2a(i); // decltype(x2a) is int decltype(auto) x2d(i); // decltype(x2d) is int auto x3a = i; // decltype(x3a) is int decltype(auto) x3d = i; // decltype(x3d) is int ...
According to 9.2.9.7 [dcl.spec.auto] paragraph 7,
If the placeholder is the decltype(auto) type-specifier, the declared type of the variable or return type of the function shall be the placeholder alone. The type deduced for the variable or return type is determined as described in 9.2.9.3 [dcl.type.simple], as though the initializer had been the operand of the decltype.
This is problematic when the parenthesized form of initializer is used, e.g.,
int i; decltype(auto) x(i);
the specification would deduce the type as decltype((i)), or int&. The wording should be clarified that the expression and not the entire initializer is considered to be the operand of decltype.
History | |||
---|---|---|---|
Date | User | Action | Args |
2017-02-06 00:00:00 | admin | set | status: drwp -> cd4 |
2015-11-10 00:00:00 | admin | set | status: dr -> drwp |
2015-05-25 00:00:00 | admin | set | messages: + msg6051 |
2015-05-25 00:00:00 | admin | set | status: tentatively ready -> dr |
2015-04-13 00:00:00 | admin | set | messages: + msg5313 |
2015-04-13 00:00:00 | admin | set | status: drafting -> tentatively ready |
2014-06-30 00:00:00 | admin | create |