Created on 2024-02-28.00:00:00 last changed 15 months ago
(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 initializedand the declarator is followed bywith 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”.
History | |||
---|---|---|---|
Date | User | Action | Args |
2024-02-28 00:00:00 | admin | create |