OpenCores
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/] [unexpected1.C] - Diff between revs 301 and 384

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 ();
  }
  }
}
}
 
 

powered by: WebSVN 2.1.0

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