* doc/Makefile.am (AM_MAKEINFOFLAGS, TEXI2DVI): Include
[binutils.git] / ld / testsuite / ld-elf / dl5.cc
blobcc404553f93bf73e4fa209efcb9f378e7e38530a
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <new>
5 int pass = 0;
7 void *
8 operator new (size_t sz, const std::nothrow_t&) throw ()
10 void *p;
11 pass++;
12 p = malloc(sz);
13 return p;
16 void *
17 operator new (size_t sz) throw (std::bad_alloc)
19 void *p;
20 pass++;
21 p = malloc(sz);
22 return p;
25 void
26 operator delete (void *ptr) throw ()
28 pass++;
29 if (ptr)
30 free (ptr);
33 class A
35 public:
36 A() {}
37 ~A() { }
38 int a;
39 int b;
43 int
44 main (void)
46 A *bb = new A[10];
47 delete [] bb;
48 bb = new (std::nothrow) A [10];
49 delete [] bb;
51 if (pass == 4)
53 printf ("PASS\n");
54 return 0;
56 else
58 printf ("FAIL\n");
59 return 1;