This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118b. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-09-28


3030. Initializing array prvalues of unknown bound

Section: 9.3.4.5  [dcl.array]     Status: open     Submitter: Jim X     Date: 2024-02-28

(From submission #509.)

Consider:

  int main(){
    using type = int[];
    type{1,2,3};
  }

Subclause 9.3.4.5 [dcl.array] paragraph 7 specifies:

... An array bound may also be omitted when an object (but not a non-static data member) of array type is initialized and the declarator is followed by an initializer (9.5 [dcl.init], 11.4 [class.mem], 7.6.1.4 [expr.type.conv], 7.6.2.8 [expr.new]). In these cases, the array bound is calculated from the number of initial elements (say, N) supplied (9.5.2 [dcl.init.aggr]), and the type of the array is “array of N U”.

However, there is no "declarator" in the example.

Possible resolution:

Change in 9.3.4.5 [dcl.array] paragraph 7 as follows:

... An array bound may also be omitted when an object (but not a non-static data member) of array type is initialized and the declarator is followed by with an initializer (9.5 [dcl.init], 11.4 [class.mem], 7.6.1.4 [expr.type.conv], 7.6.2.8 [expr.new]). In these cases, the array bound is calculated from the number of initial elements (say, N) supplied (9.5.2 [dcl.init.aggr]), and the type of the array is “array of N U”.