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

2023-01-15


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

Section: 7.6.2.8  [expr.new]     Status: CD3     Submitter: John Spicer     Date: 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-clauses 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 type std::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 of issue 1464.