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

2024-11-11


1270. Brace elision in array temporary initialization

Section: 9.4.5  [dcl.init.list]     Status: CD3     Submitter: Jason Merrill     Date: 2011-03-23

[Moved to DR at the October, 2012 meeting.]

Issue 1232 extended the language to allow creation of array temporaries using initializer lists. However, such initializer lists must be “completely braced;” the elision of braces described in 9.4.2 [dcl.init.aggr] paragraph 11 applies only

In a declaration of the form

  T x = { a };

This restriction prevents plausible uses like

    array<int, 3> f() {
      return { 1, 2, 3 };
    }

Proposed resolution (February, 2012):

Change 9.4.2 [dcl.init.aggr] paragraph 11 as follows:

In a declaration of the form

braces Braces can be elided in an initializer-list as follows. [Footnote: Braces cannot be elided in other uses of list-initialization. —end footnote]