CWG Issue 1559 (original) (raw)

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

2025-11-05


1559. String too long in initializer list of new-expression

Section: 7.6.2.8 [expr.new]Status: CD3Submitter: John SpicerDate: 2012-09-21

[Moved to DR at the April, 2013 meeting.]

According to 7.6.2.8 [expr.new] paragraph 7,

if the new-initializer is a braced-init-list for which the number of initializer-clause_s exceeds the number of elements to initialize, no storage is obtained and the_new-expression terminates by throwing an exception of a type that would match a handler (14.4 [except.handle]) of typestd::bad_array_new_length (17.6.4.2 [new.badlength]).

This wording does not, but presumably should, require an exception to be thrown in a case like

void f() { int x = 3; new char[x]{"abc"}; }

(See also issue 1464.)

Proposed resolution (October, 2012):

This issue is resolved by the resolution ofissue 1464.