URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Subversion Repositories openrisc_2011-10-31
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.jason/] [new.C] - Rev 154
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 (size_t);
size_t s;
void * operator new (size_t siz) throw (std::bad_alloc) {
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;
}