OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.old-deja/] [g++.brendan/] [new3.C] - Rev 699

Compare with Previous | Blame | View Log

// This test fails on VxWorks in kernel mode because it depends on the
// library version of "::operator new[]" calling the "::operator new"
// defined in this module.  This doesn't work because the library version
// of "::operator new[]" is built into the kernel itself; library relocations
// are resolved when the kernel is linked.
// { dg-do run { xfail { powerpc-ibm-aix* || vxworks_kernel } } }
// { dg-options "-flat_namespace" { target *-*-darwin[67]* } }
// Avoid use of none-overridable new/delete operators in shared
// { dg-options "-static" { target *-*-mingw* } }
// GROUPS passed operator-new
#include <stdio.h>
#include <stdlib.h>
#include <new>

int pass = 0;

void *operator new(size_t sz)
#if __cplusplus <= 199711L
  throw (std::bad_alloc)
#endif
{

  void *p;

  pass = 1;
  p = malloc(sz);
  return p;
}

class A {
public:
  A() {}
  ~A() {}

  int a;
  int b;
};


int main()
{
  A *bb = new A[10];
  delete [] bb;

  if (pass)
    printf ("PASS\n");
  else
    { printf ("FAIL\n"); return 1; }
}

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.