• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // { dg-do run  }
2 // It checks to see if you can define your own global new operator.
3 // prms-id: 755
4 
5 #include <stddef.h>
6 #include <new>
7 
8 extern "C" void _exit(int);
9 
operator new(size_t sz)10 void* operator new(size_t sz) throw (std::bad_alloc) {
11   void* p = 0;
12   _exit(0);
13   return p;
14 }
15 
main()16 int main () {
17   int* i = new int;
18   delete i;
19   return 1;
20 }
21