Date
2010-06-01.00:00:00
Message id
2784

Content

Issue 990 added the following text to 9.5.5 [dcl.init.list] paragraph 3:
  • Otherwise, if the initializer list has no elements and T is an aggregate, each of the members of T is initialized from an empty initializer list. [Example:...

A better way to handle this would be to delete that bullet and change 9.5.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.5 [dcl.init]) initialized from an empty initializer list (9.5.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 };