Copy-initialization of arrays
9.4.1 [dcl.init.general]
Anoop Rana

Created on 2023-11-06.00:00:00 last changed 3 weeks ago


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: 2023-11-08.05:03:56


  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.

Date User Action Args
2023-11-08 05:03:56adminsetmessages: + msg7499
2023-11-08 05:03:56adminsetstatus: open -> review
2023-11-06 00:00:00admincreate