Description
Full name of submitter (unless configured in github; will be published with the issue): Benjamin Sch.
Reference (section label): [expr.new]
Link to reflector thread (if any):
Issue description:
[expr.new] contains specific wording to handle aggregate initialization with braces for array new, e.g.
int n = 2;
new int[n]{1,2,3};
is specified to throw an exception.
However, [expr.new] doesn't seem to have any wording regarding parenthesized aggregate initialization for the analogous situations, e.g.
int n = 2;
new int[n](1,2,3);
Suggested resolution:
Modify [expr.new]/8.4:
the new-initializer is
a braced-init-listpresent and the number of array elements for which initializers are provided (including the terminating '\0' in a string-literal ([lex.string])) exceeds the number of elements to initialize.
Modify [expr.new]/9:
If the allocated type is an array, the new-initializer is
a braced-init-listpresent but not()
, and the expression is potentially-evaluated and not a core constant expression, the semantic constraints of copy-initializing a hypothetical element of the array from an empty initializer list are checked ([dcl.init.list]).