aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/bad_array_new1.C
blob: 2052d3991e83eb4b4c767e911306c4577ccaef71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Test for throwing bad_array_new_length on invalid array length
// { dg-do run { target c++11 } }

#include <new>

void * f(int i)
{
  return new int[i];
}

int main()
{
  try
    {
      f(-1);
    }
  catch (std::bad_array_new_length) { return 0; }
  __builtin_abort ();
}