URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 301 |
Rev 384 |
// PR 3719
|
// PR 3719
|
// Test that an unexpected handler can rethrow to categorize.
|
// Test that an unexpected handler can rethrow to categorize.
|
// { dg-do run }
|
// { dg-do run }
|
|
|
#include
|
#include
|
|
|
extern "C" void abort ();
|
extern "C" void abort ();
|
|
|
struct One { };
|
struct One { };
|
struct Two { };
|
struct Two { };
|
|
|
static void
|
static void
|
handle_unexpected ()
|
handle_unexpected ()
|
{
|
{
|
try
|
try
|
{
|
{
|
throw;
|
throw;
|
}
|
}
|
catch (One &)
|
catch (One &)
|
{
|
{
|
throw Two ();
|
throw Two ();
|
}
|
}
|
}
|
}
|
|
|
static void
|
static void
|
doit () throw (Two)
|
doit () throw (Two)
|
{
|
{
|
throw One ();
|
throw One ();
|
}
|
}
|
|
|
int main ()
|
int main ()
|
{
|
{
|
std::set_unexpected (handle_unexpected);
|
std::set_unexpected (handle_unexpected);
|
|
|
try
|
try
|
{
|
{
|
doit ();
|
doit ();
|
}
|
}
|
catch (Two &)
|
catch (Two &)
|
{
|
{
|
}
|
}
|
catch (...)
|
catch (...)
|
{
|
{
|
abort ();
|
abort ();
|
}
|
}
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.