This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 113b. See for the official list.


2076. List-initialization of arguments for constructor parameters

Section:  []     Status: CD4     Submitter: Richard Smith     Date: 2015-01-27

[Adopted at the June, 2016 meeting.]

The resolution of issue 1467 made some plausible constructs ill-formed. For example,

   struct A { A(int); };
   struct B { B(A); };
   B b{{0}};

This is now ambiguous, because the text disallowing user-defined conversions for B's copy and move constructors was removed from [] paragraph 4. Another example:

  struct Params { int a; int b; };
  class Foo {
  Foo foo{{1, 2}};

This is now ambiguous between Foo(Params) and Foo(Foo&&).

For non-class types, we allow initialization from a single-item list to perform a copy only if the element within the list is not itself a list ( [over.ics.list] bullet 9.1). The analogous rule for this case would be to add back the bullet in [] paragraph 4, but only in the case where the initializer is itself an initializer list:

the second phase of [over.match.list] when the initializer list has exactly one element that is itself an initializer list, where the target is the first parameter of a constructor of class X, and the conversion is to X or reference to (possibly cv-qualified) X,

Proposed resolution (March, 2016):

Change [] paragraph 4 as follows:

...and the constructor or user-defined conversion function is a candidate by

user-defined conversion sequences are not considered. [Note:...