Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.other / new6.C
blob3afb2b7e489f294b68d02a0cae0e45cfb52db273
1 // { dg-do run  }
2 // Test that we properly default-initialize the new int when () is given.
4 #include <new>
5 using namespace std;
6 extern "C" void *malloc (size_t);
8 int special;
9 int space = 0xdeadbeef;
11 void *operator new (size_t size) throw (bad_alloc)
13   if (special)
14     return &space;
15   return malloc (size);
18 int main ()
20   special = 1;
21   int *p = new int();
22   special = 0;
23   return *p != 0;