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

2024-04-18


1070. Missing initializer clauses in aggregate initialization

Section: 9.4.2  [dcl.init.aggr]     Status: C++11     Submitter: Jason Merrill     Date: 2010-06-01

[Voted into the WP at the November, 2010 meeting.]

Issue 990 added the following text to 9.4.5 [dcl.init.list] paragraph 3:

A better way to handle this would be to delete that bullet and change 9.4.2 [dcl.init.aggr] paragraph 7 as follows:

If there are fewer initializer-clauses in the list than there are members in the aggregate, then each member not explicitly initialized shall be value-initialized (9.4 [dcl.init]) initialized from an empty initializer list (9.4.5 [dcl.init.list]).

This makes { } less of a special case and makes the following example work:

    struct A {
       A(std::initializer_list<int>);
    };
    struct B {
       int i;
       A a;
    };
    B b = { 1 };

Proposed resolution (August, 2010):

  1. Delete 9.4.5 [dcl.init.list] bullet 3.2, includeing the example:

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

  3. If there are fewer initializer-clauses in the list than there are members in the aggregate, then each member not explicitly initialized shall be value-initialized (9.4 [dcl.init]) initialized from an empty initializer list (9.4.5 [dcl.init.list]).