Home | History | Annotate | Download | only in jni
      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 
     11 void *operator new (size_t size) throw (bad_alloc)
     12 {
     13   if (special)
     14     return &space;
     15   return malloc (size);
     16 }
     17 
     18 int main ()
     19 {
     20   special = 1;
     21   int *p = new int();
     22   special = 0;
     23   return *p != 0;
     24 }
     25