cplusplus / CWG

Core Working Group
23 stars 7 forks source link

CWG2790 [over.ics.list] p8 refers to a UDCS with an "aggregate initialization" - there is no such thing #401

Open RealLitb opened 1 year ago

RealLitb commented 1 year ago

Full name of submitter (unless configured in github; will be published with the issue): Johannes Schaub

Reference (section label): https://eel.is/c++draft/over.ics.list#8.sentence-1

Link to reflector thread (if any): Message c++std-core-18566 , Issue number ########2).

Issue description: (Note: an issue report was mailed 13 years ago (-> reflector message), but unfortunately wasn't converted into an official core issue. Trying this again today!).

Says

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

But a user-defined conversion sequence is defined as a SCS, followed by a UDC, followed by another SCS. A UDC is either a call to a conversion function or a call to a constructor. Neither one of them happens for aggregate initialization! https://eel.is/c++draft/over.ics.user#1.sentence-1

A user-defined conversion sequence consists of an initial standard conversion sequence followed by a user-defined conversion ([class.conv]) followed by a second standard conversion sequence.

The aggregate initialization is a constituent of a user defined conversion sequence, because it's used when ranking UCSes against each other.

Suggested resolution: Therefore the definition of "user defined conversion sequence" should mention that instead of a user-defined conversion in the middle between the two SCSes, an aggregate initialization can appear instead of a UDC. Or at the very least, make the UDC inside of a UDCS optional.

jensmaurer commented 1 year ago

CWG2790