https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102514

--- Comment #2 from jim x <xmh970252187 at gmail dot com> ---
It seems that they all do not obey [expr.new] p9, which says that

If the expression in a noptr-new-declarator is present, it is implicitly
converted to std​::​size_­t. The expression is erroneous if:

- the expression is of non-class type and its value before converting to
std​::​size_­t is less than zero;

- [...]

If the expression is erroneous after converting to std​::​size_­t: 

- if the expression is a core constant expression, the program is ill-formed; 

- otherwise, an allocation function is not called; instead

  - if the allocation function that would have been called has a non-throwing 
    exception specification ([except.spec]), the value of the new-expression is 
    the null pointer value of the required result type;  

  - otherwise, the new-expression terminates by throwing an exception of a type 
    that would match a handler ([except.handle]) of type
std​::​bad_­array_­new_­ 
    length.

Reply via email to