This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-12-19
[Moved to DR at the May, 2015 meeting.]
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.
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 ...