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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Erroneous expressions include negative ones, as in PR 105077:

#include <new>
#include <stdexcept>
int main()  
{
  try 
  {
    int negative = -1;
    new char[negative];
  } 
  catch(const std::bad_array_new_length &e) 
  {
  }
  return 0;
}

This throws bad_alloc instead of bad_array_new_length.

PR 99934 is another example where we should not call the allocation function,
but the FE should return a nullptr instead of throwing.

Reply via email to