https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105077
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- (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.