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

--- Comment #5 from marshal <chumarshal at foxmail dot com> ---
(In reply to Jonathan Wakely from comment #4)
> (In reply to marshal from comment #3)
> > But why "new int[negative];" throws std::bad_array_new_length as following
> > case?
> 
> Because that case requires size_t(-1) * sizeof(int) and the compiler detects
> that it's out of range. It fails to detect that size_t(-1) is already
> incorrect.
> 
> > I think "new int[negative]" and "new char[negative]" should both throw
> > std::bad_array_new_length when "int negative = -1;". 
> 
> Yes, it's a bug.

Please modify "Status:RESOLVED DUPLICATE of bug 8579", because it's a new bug
and it's not same with bug 8579.

Reply via email to