Description
Reference (section label): [dcl.init.list], [over.ics.list]
Link to reflector thread (if any): https://lists.isocpp.org/ext/2023/04/21015.php
Issue description:
[dcl.init.list] says that a designated-initializer-list can only be used to initialize an aggregate class. [over.ics.list] says that a designated-initializer-list can only be used to form an implicit conversion sequence for an aggregate. Longstanding implementation practice and expectations of consistency suggest that we should additionally permit initialization of a (const or rvalue) reference to aggregate class, creating a temporary as normal.
Suggested resolution:
Change in [dcl.init.list]/3.1:
- If the braced-init-list contains a designated-initializer-list and
T
is not a reference type,T
shall be an aggregate class. [...]
Change in [over.ics.list]/2:
If the initializer list is a designated-initializer-list and the the parameter is not a reference, a conversion is only possible if the parameter has an aggregate type that can be initialized from the initializer list according to the rules for aggregate initialization ([dcl.init.aggr])