aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.old-deja/g++.mike/p755.C
blob: ee6198dfb6cfe9c56f6ce59d2f4c2e6d9666158c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// { dg-do run  }
// It checks to see if you can define your own global new operator.
// prms-id: 755

#include <new>

extern "C" void _exit(int);

void* operator new(std::size_t sz)
#if __cplusplus <= 199711L
  throw (std::bad_alloc)
#endif
{
  void* p = 0;
  _exit(0);
  return p;
}

int main () {
  int* i = new int;
  delete i;
  return 1;
}