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

2024-04-28


2790. Aggregate initialization and user-defined conversion sequence

Section: 12.2.4.2.6  [over.ics.list]     Status: open     Submitter: Johannes Schaub     Date: 2023-08-18

Subclause 12.2.4.2.6 [over.ics.list] paragraph 8 specifies:

Otherwise, if the parameter has an aggregate type which can be initialized from the initializer list according to the rules for aggregate initialization (9.4.2 [dcl.init.aggr]), the implicit conversion sequence is a user-defined conversion sequence whose second standard conversion sequence is an identity conversion.

However, a user-defined conversion sequence cannot contain an aggregate initialization per 12.2.4.2.3 [over.ics.user] paragraph 1:

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.

To complete the argument, subclause 11.4.8 [class.conv] paragraph 1 specifies:

Type conversions of class objects can be specified by constructors and by conversion functions. These conversions are called user-defined conversions...

Possible resolution:

Change in 12.2.4.2.3 [over.ics.user] paragraph 1 as follows:

A user-defined conversion sequence consists of an initial standard conversion sequence, followed by a user-defined conversion (11.4.8 [class.conv]) or an aggregate initialization (9.4.2 [dcl.init.aggr]), followed by a second standard conversion sequence.