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++.other/] [new7.C] - Rev 154
Compare with Previous | Blame | View Log
// { dg-do run }
// Origin: philip_martin@ntlworld.com
#include <new>
extern "C" void abort();
bool new_flag = false;
bool delete_flag = false;
struct X {
X()
{
throw 1;
}
void* operator new ( std::size_t n ) throw ( std::bad_alloc )
{
new_flag = true;
return ::operator new( n );
}
void operator delete( void* p, std::size_t n ) throw()
{
delete_flag = true;
::operator delete( p );
}
};
int
main()
{
try
{
X* x = new X; // gcc 3.0 fails to call operator delete when X::X throws
}
catch ( ... )
{
}
if ( ! new_flag || ! delete_flag )
::abort();
}