Automatic date update in version.in
[binutils-gdb.git] / ld / testsuite / ld-elf / dl5.cc
blob1cd33c061594a94978a8868bf7d6a3d5e84d69e7
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <new>
4 #include "dl5.h"
6 int pass = 0;
8 void *
9 operator new (size_t sz, const std::nothrow_t&) throw ()
11 void *p;
12 pass++;
13 p = malloc(sz);
14 return p;
17 void *
18 operator new (size_t sz) throw (std::bad_alloc)
20 void *p;
21 pass++;
22 p = malloc(sz);
23 return p;
26 void
27 operator delete (void *ptr) throw ()
29 pass++;
30 if (ptr)
31 free (ptr);
34 int
35 main (void)
37 A *bb = new A[10];
38 foo (bb);
39 delete [] bb;
40 bb = new (std::nothrow) A [10];
41 foo (bb);
42 delete [] bb;
44 if (pass == 4)
46 printf ("PASS\n");
47 return 0;
49 else
51 printf ("FAIL\n");
52 return 1;