summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/compat/eh/new1_x.C
blob: 1212871708947472ccc217a0643a42871617e0f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <new>
#include <cstddef>

extern "C" void exit (int);
extern "C" void abort (void);

extern void * operator new[] (std::size_t s) throw (std::bad_alloc);
extern void operator delete[] (void *p) throw ();

struct A
{
  A() { throw 1; }
  ~A() {}
};

int ret = 1;

void
new1_x ()
{
  try
    {
      A *p = new A[4];
    }
  catch (...) {}
  if (ret != 0)
    abort ();
  exit (0);
}