2008-05-30 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.brendan / new3.C
blob791d00bac9635ebf202ad781a49a59bbfdf5ad49
1 // This test fails on VxWorks in kernel mode because it depends on the
2 // library version of "::operator new[]" calling the "::operator new"
3 // defined in this module.  This doesn't work because the library version
4 // of "::operator new[]" is built into the kernel itself; library relocations
5 // are resolved when the kernel is linked.
6 // { dg-do run { xfail { powerpc-ibm-aix* || vxworks_kernel } } }
7 // { dg-options "-flat_namespace" { target *-*-darwin[67]* } }
8 // GROUPS passed operator-new
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <new>
13 int pass = 0;
15 void *operator new(size_t sz) throw (std::bad_alloc) {
17   void *p;
19   pass = 1;
20   p = malloc(sz);
21   return p;
24 class A {
25 public:
26   A() {}
27   ~A() {}
29   int a;
30   int b;
34 int main()
36   A *bb = new A[10];
37   delete [] bb;
39   if (pass)
40     printf ("PASS\n");
41   else
42     { printf ("FAIL\n"); return 1; }