OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [eh/] [unexpected1.C] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
// PR 3719
2
// Test that an unexpected handler can rethrow to categorize.
3
// { dg-do run }
4
 
5
#include 
6
 
7
extern "C" void abort ();
8
 
9
struct One { };
10
struct Two { };
11
 
12
static void
13
handle_unexpected ()
14
{
15
  try
16
  {
17
    throw;
18
  }
19
  catch (One &)
20
  {
21
    throw Two ();
22
  }
23
}
24
 
25
static void
26
doit () throw (Two)
27
{
28
  throw One ();
29
}
30
 
31
int main ()
32
{
33
  std::set_unexpected (handle_unexpected);
34
 
35
  try
36
  {
37
    doit ();
38
  }
39
  catch (Two &)
40
  {
41
  }
42
  catch (...)
43
  {
44
    abort ();
45
  }
46
}

powered by: WebSVN 2.1.0

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