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] - Blame information for rev 772

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 699 jeremybenn
// { dg-do assemble  }
2
// Bug: new doesn't make sure that the count is an integral value.
3
 
4
#include 
5
extern "C" int printf (const char *, ...);
6
extern "C" void *malloc (std::size_t);
7
std::size_t s;
8
 
9
void * operator new (std::size_t siz)
10
#if __cplusplus <= 199711L
11
  throw (std::bad_alloc)
12
#endif
13
{
14
  if (s == 0)
15
    s = siz;
16
  else
17
    s = (s != siz);
18
  return malloc (siz);
19
}
20
 
21
int main()
22
{
23
  s = 0;
24
 
25
  float f = 3;
26
  int* b1 = new int[(int)f];
27
  int* b2 = new int[f];         // { dg-error "" } new requires integral size
28
 
29
  return s;
30
}

powered by: WebSVN 2.1.0

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