1 // { dg-do run  }
2 // Test that we properly default-initialize the new int when () is given.
3 
4 #include <new>
5 using namespace std;
6 extern "C" void *malloc (size_t);
7 
8 int special;
9 int space = 0xdeadbeef;
10 
new(size_t size)11 void *operator new (size_t size)
12 #if __cplusplus <= 199711L
13   throw (std::bad_alloc)
14 #endif
15 {
16   if (special)
17     return &space;
18   return malloc (size);
19 }
20 
main()21 int main ()
22 {
23   special = 1;
24   int *p = new int();
25   special = 0;
26   return *p != 0;
27 }
28