Title
Copy-initialization of arrays
Status
drwp
Section
9.4.1 [dcl.init.general]
Submitter
Anoop Rana

Created on 2023-11-06.00:00:00 last changed 5 months ago

Messages

Date: 2023-11-08.05:03:56

Proposed resolution (approved by CWG 2023-11-07):

Change in 9.4.1 [dcl.init.general] bullet 16.5 as follows:

Otherwise, if the destination type is an array, the object is initialized as follows. The initializer shall be of the form ( expression-list ). Let x1 , . . . , xk be the elements of the expression-list. If the destination type is an array of unknown bound, it is defined as having k elements. Let n denote the array size after this potential adjustment. If k is greater than n, the program is ill-formed. Otherwise, ...
Date: 2024-03-15.00:00:00

[Accepted as a DR at the March, 2024 meeting.]

Consider:

  std::string arr[] = "some string";

Prior to the application of paper P0960R3 (Allow initializing aggregates from a parenthesized list of values), this was ill-formed, but now it is well-formed. However, the specification talks about an expression-list as part of the initializer, which does not exist in this case.

History
Date User Action Args
2024-07-20 13:52:34adminsetstatus: dr -> drwp
2024-04-05 21:43:46adminsetstatus: ready -> dr
2024-03-20 14:10:31adminsetstatus: tentatively ready -> ready
2023-12-02 15:54:05adminsetstatus: review -> tentatively ready
2023-11-08 05:03:56adminsetmessages: + msg7499
2023-11-08 05:03:56adminsetstatus: open -> review
2023-11-06 00:00:00admincreate