Title
List-initialization sequence with a user-defined conversion
Status
open
Section
12.2.4.2.3 [over.ics.user]
Submitter
Brian Bi

Created on 2023-05-11.00:00:00 last changed 11 months ago

Messages

Date: 2023-05-14.07:05:10

Suggested resolution:

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

  • ...
  • Otherwise, the implicit conversion sequence is a user-defined conversion sequence whose user-defined conversion is specified by the constructor C and whose first and second standard conversion sequence is an sequences are identity conversion conversions.
Date: 2023-05-11.00:00:00

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.

History
Date User Action Args
2023-05-13 20:42:09adminsetmessages: + msg7287
2023-05-11 00:00:00admincreate