Created on 2023-04-06.00:00:00 last changed 11 months ago
Proposed resolution (approved by CWG 2023-04-28):
Change in 9.4.5 [dcl.init.list] bullet 3.1 as follows:
- 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 9.4.5 [dcl.init.list] bullet 3.9 as follows:
Otherwise, if the initializer list is not a designated-initializer-list and has a single element of type E and ...
Change in 9.4.5 [dcl.init.list] bullet 3.10 as follows:
[ Example:... const B& b2{a}; // error: cannot copy-list-initialize B temporary from A struct C { int x; }; C&& c = { .x = 1 }; // OK-- end example ]
Change in 12.2.4.2.6 [over.ics.list] paragraph 2 as follows:
If the initializer list is a designated-initializer-list and 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 (9.4.2 [dcl.init.aggr]), in which case the implicit conversion sequence is a user-defined conversion sequence whose second standard conversion sequence is an identity conversion.
[Accepted as a DR at the June, 2023 meeting.]
Aggregates can be initialized by a designated initializer list, but references to aggregates cannot, although list-initialization of such with a regular braced-init-list is fine.
Subclause 9.4.5 [dcl.init.list] paragraph 3 specifies:
List-initialization of an object or reference of type T is defined as follows:
- If the braced-init-list contains a designated-initializer-list, T shall be an aggregate class. ...
- ...
- Otherwise, if T is a reference type, a prvalue is generated. The prvalue initializes its result object by copy-list-initialization from the initializer list. The prvalue is then used to direct-initialize the reference. The type of the prvalue is the type referenced by T, unless ...
- ...
Subclause 12.2.4.2.6 [over.ics.list] paragraph 2 specifies:
If the initializer list is a designated-initializer-list, 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 (9.4.2 [dcl.init.aggr]), in which case the implicit conversion sequence is a user-defined conversion sequence whose second standard conversion sequence is an identity conversion.
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-12-19 10:15:28 | admin | set | status: dr -> drwp |
2023-07-16 13:00:43 | admin | set | status: ready -> dr |
2023-04-28 19:41:23 | admin | set | status: open -> ready |
2023-04-08 19:13:08 | admin | set | messages: + msg7244 |
2023-04-06 00:00:00 | admin | create |