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

2024-04-18


1768. Zero-element array of runtime bound

Section: 9.3.4.5  [dcl.array]     Status: NAD     Submitter: USA     Date: 2013-09-24

N3690 comment US 9

C-style variable-length arrays (which have been widely implemented as extensions to C++) permit a zero-length array. Similarly, arrays created by new-expressions can have a length of zero. Forbidding zero-length arrays of runtime bound is a gratuitous incompatibility.

Proposed resolution (September, 2013):

  1. Change 9.3.4.5 [dcl.array] paragraph 1 as follows:

  2. ...The expression is erroneous if:

    If the expression, after converting to std::size_t, is a core constant expression and the expression is erroneous or its value is zero, the program is ill-formed. If the expression... std::bad_array_length (_N3690_.18.6.2.2 [bad.array.length]) is thrown. An object of array type If N is zero, an object of array type has no elements. Otherwise, it contains a contiguously allocated non-empty set of N subobjects of type T. The type...

Rationale (February, 2014):

The specification was removed from the WP and moved into a Technical Specification.