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

2024-08-20


2912. Too-large value for size in array new

Section: 7.6.2.8  [expr.new]     Status: open     Submitter: Mital Ashok     Date: 2024-06-20

(From submission #560.)

Consider an implementation with a size_t smaller than long long. An implementation should flag too-large values for the size in an array "new", in the same manner it flags negative values. For example:

  int *p = new int[ULLONG_MAX];

Possible resolution:

Change in 7.6.2.8 [expr.new] paragraph 8 as follows:

If the expression in a noptr-new-declarator is present, it is implicitly converted to std::size_t. The value of the expression is invalid if: