decltype(auto) with direct-list-initialization
Section [dcl.spec.auto]
Vinny Romano

Created on 2014-06-30.00:00:00 last changed 68 months ago


Date: 2014-11-15.00:00:00

Rationale (November, 2014):

CWG felt that this was a question of language design and thus more properly dealt with by EWG.

Date: 2014-06-30.00:00:00

Paper N3922 changed the rules for deduction from a braced-init-list containing a single expression in a direct-initialization context. Should a corresponding change be made for decltype(auto)? E.g.,

  auto x8a = { 1 };           // decltype(x8a) is std::initializer_list<int>
  decltype(auto) x8d = { 1 }; // ill-formed, a braced-init-list is not an expression
  auto x9a{ 1 };              // decltype(x9a) is int
  decltype(auto) x9d{ 1 };    // decltype(x9d) is int

See also issue 1467, which also effectively ignores braces around a single expression, this change would be parallel to that one, even though the primary motivation for delctype(auto) is in the return type of a forwarding function, where direct-initialization does not apply.

Date User Action Args
2014-11-24 00:00:00adminsetmessages: + msg5307
2014-06-30 00:00:00admincreate