This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 112c. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2023-11-10


1957. decltype(auto) with direct-list-initialization

Section: 9.2.9.6  [dcl.spec.auto]     Status: NAD     Submitter: Vinny Romano     Date: 2014-06-30

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.

Rationale (November, 2014):

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

EWG 2022-11-11

This is a request for a new feature, which should be proposed in a paper to EWG.