Created on 2009-07-12.00:00:00 last changed 131 months ago
[Voted into the WP at the March, 2011 meeting.]
Proposed resolution (January, 2011):
Change 7.6.2.8 [expr.new] paragraph 7 as follows:
When the value of the expression in a noptr-new-declarator is zero, the allocation function is called to allocate an array with no elements. If the value of that expression is less than zero or such that the size of the allocated object would exceed the implementation-defined limit, or 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]).
Notes from the August, 2010 meeting:
The consensus of the CWG was that this case should throw an exception at runtime.
9.4.2 [dcl.init.aggr] paragraph 4 says,
An initializer-list is ill-formed if the number of initializer-clauses exceeds the number of members or elements to initialize.
However, in a new-expression, the number of elements to be initialized is potentially unknown at compile time. How should an overly-long initializer-list in a new-expression be treated?
History | |||
---|---|---|---|
Date | User | Action | Args |
2014-03-03 00:00:00 | admin | set | status: fdis -> c++11 |
2011-04-10 00:00:00 | admin | set | messages: + msg3347 |
2011-04-10 00:00:00 | admin | set | status: tentatively ready -> fdis |
2011-02-28 00:00:00 | admin | set | messages: + msg3231 |
2011-02-28 00:00:00 | admin | set | status: drafting -> tentatively ready |
2010-08-23 00:00:00 | admin | set | messages: + msg2854 |
2010-08-23 00:00:00 | admin | set | status: open -> drafting |
2009-07-12 00:00:00 | admin | create |