URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Subversion Repositories openrisc_2011-10-31
[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [g++.dg/] [eh/] [new1.C] - Rev 301
Go to most recent revision | Compare with Previous | Blame | View Log
// PR c++/5757
// Test that when a constructor throws in a new-expression, we pass the
// right pointer to operator delete.
// { dg-do run }
#include <new>
int ret = 1;
void *ptr;
void * operator new[] (size_t s) throw (std::bad_alloc)
{
ptr = operator new (s);
return ptr;
}
void operator delete[] (void *p) throw ()
{
if (p == ptr)
ret = 0;
operator delete (p);
}
struct A
{
A() { throw 1; }
~A() {}
};
int
main ()
{
try
{
A *p = new A[4];
}
catch (...) {}
return ret;
}
Go to most recent revision | Compare with Previous | Blame | View Log