Title
decltype(auto) with direct-list-initialization
Status
nad
Section
9.2.9.7 [dcl.spec.auto]
Submitter
Vinny Romano

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

Messages

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.

EWG 2022-11-11

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

Date: 2022-11-20.07:54:16

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.

History
Date User Action Args
2022-11-24 21:03:27adminsetstatus: extension -> nad
2014-11-24 00:00:00adminsetmessages: + msg5307
2014-06-30 00:00:00admincreate