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

Subversion Repositories openrisc

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

Compare with Previous | Blame | View Log

// { dg-do assemble  }
// Bug: new doesn't make sure that the count is an integral value.

#include <new>
extern "C" int printf (const char *, ...);
extern "C" void *malloc (std::size_t);
std::size_t s;

void * operator new (std::size_t siz)
#if __cplusplus <= 199711L
  throw (std::bad_alloc)
#endif
{
  if (s == 0)
    s = siz;
  else
    s = (s != siz);
  return malloc (siz);
}

int main()
{
  s = 0;

  float f = 3;
  int* b1 = new int[(int)f];
  int* b2 = new int[f];         // { dg-error "" } new requires integral size

  return s;
}

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.