CWG Issue 1270 (original) (raw)

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

2025-11-05


1270. Brace elision in array temporary initialization

Section: 9.5.5 [dcl.init.list]Status: CD3Submitter: Jason MerrillDate: 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.5.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.5.2 [dcl.init.aggr] paragraph 11 as follows:

In a declaration of the form

T x = { a };

braces Braces can be elided in an_initializer-list_ as follows. [Footnote: Braces cannot be elided in other uses of list-initialization. —_end footnote_]