Created on 2024-05-29.00:00:00 last changed 4 months ago
Proposed resolution (approved by CWG 2024-06-14):
Change in 9.4.1 [dcl.init.general] paragraph 16 as follows:
The semantics of initializers are as follows. The destination type is the cv-unqualified type of the object or reference being initialized and the source type is the type of the initializer expression. If the initializer is not a single (possibly parenthesized) expression, the source type is not defined.
Change in 9.4.1 [dcl.init.general] bullet 16.6 as follows:
- Otherwise, if the destination type is a
(possibly cv-qualified)class type:
- If the initializer expression is a prvalue and the cv-unqualified version of the source type is the same
class as the class ofas the destination type, the initializer expression is used to initialize the destination object. [Example 2: T x = T(T(T())); value-initializes x. —end example]- Otherwise, if the initialization is direct-initialization, or if it is copy-initialization where the cv-unqualified version of the source type is the same
class as, or a derived class of, the class ofas or is derived from the destination type, constructors are considered. The applicable constructors are enumerated (12.2.2.4 [over.match.ctor]), and the best one is chosen through overload resolution (12.2 [over.match]). Then:
Change in 9.4.1 [dcl.init.general] bullet 16.9 as follows:
- Otherwise, the initial value of the object being initialized is the (possibly converted) value of the initializer expression. A standard conversion sequence (7.3 [conv]) is used to convert the initializer expression to a prvalue of
the cv-unqualified version ofthe destination type; no user-defined conversions are considered. If the conversion cannot be done, the initialization is ill-formed. When initializing a bit-field with a value that it cannot represent, the resulting value of the bit-field is implementation-defined. [ Note: ... ]
[Accepted as a DR at the June, 2024 meeting.]
(From submission #541.)
Initialization of cv T follows the same rules as initialization of T. Issue 2830 clarified this for list-initialization. Further amendments are needed to properly handle cv-qualified versions of char8_t and char16_t as well as bool.
History | |||
---|---|---|---|
Date | User | Action | Args |
2024-07-20 13:52:34 | admin | set | status: ready -> dr |
2024-06-27 04:25:11 | admin | set | status: tentatively ready -> ready |
2024-06-14 20:31:51 | admin | set | status: open -> tentatively ready |
2024-05-30 22:19:05 | admin | set | messages: + msg7712 |
2024-05-29 00:00:00 | admin | create |