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

2024-12-19


2731. List-initialization sequence with a user-defined conversion

Section: 12.2.4.2.3  [over.ics.user]     Status: open     Submitter: Brian Bi     Date: 2023-05-11

Consider:

  struct C {
    C(int);
  };

  struct A {
    A(C);
  };

  struct B {
    B(C);
  };

  int f(const A&);
  int f(B&&);

  int x = f({1});

Subclause 12.2.4.2.3 [over.ics.user] paragraph 1 specifies:

A user-defined conversion sequence consists of an initial standard conversion sequence followed by a user-defined conversion (11.4.8 [class.conv]) followed by a second standard conversion sequence. If the user-defined conversion is specified by a constructor (11.4.8.2 [class.conv.ctor]), the initial standard conversion sequence converts the source type to the type of the first parameter of that constructor. ...

However, there is no "source type" for an initializer list, making the treatment of the example unclear.

Suggested resolution:

Change in 12.2.4.2.6 [over.ics.list] bullet 7.2 as follows: