This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-12-20
[Voted into WP at March, 2010 meeting as part of document N3079.]
It should always be possible to use the new brace syntax tovalue-initialize an object. However, the current rules make thefollowing example ill-formed because of ambiguity:
struct S { S(); S(std::initializer_list<int>); S(std::initializer_list<double>); }; S s{}; // Ambiguous initializer-list constructor reference, // not value initialization.Proposed resolution (February, 2010):
Change 9.5.5 [dcl.init.list] paragraph 3 as follows:
List-initialization of an object or reference of typeT isdefined as follows:
If the initializer list has no elements andT isa class type with a default constructor, the object isvalue-initialized.
Otherwise, if the initializer list has no elementsandT is an aggregate, the initializer list is used toinitialize each of the members ofT. [Example:
struct A { A(std::initializer_list<int>); // #1 }; struct B { A a; }; B b { }; // OK, uses #1 B b { 1 }; // error—end example]
IfOtherwise, ifT is anaggregate......
[Example:
struct S { S(std::initializer_list<double>); // #1 S(std::initializer_list<int>); // #2 S(); // #3 // ... }; S s1 = { 1.0, 2.0, 3.0 }; // invoke #1 S s2 = { 1, 2, 3 }; // invoke #2 S s3 = { }; // invoke #3 (for value-initialization; see above)—end example]