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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.old-deja/] [g++.eh/] [rethrow5.C] - Blame information for rev 699

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 699 jeremybenn
// { dg-do run  }
2
// Testcase for proper handling of rethrow.
3
 
4
#include 
5
 
6
int c, d;
7
 
8
struct A
9
{
10
  int i;
11
  A () { i = ++c; printf ("A() %d\n", i); }
12
  A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); }
13
  ~A() { printf ("~A() %d\n", i); ++d; }
14
};
15
 
16
int
17
main ()
18
{
19
  try
20
    {
21
      try
22
        {
23
          printf ("Throwing 1...\n");
24
          throw A();
25
        }
26
      catch (A)
27
        {
28
          try
29
            {
30
              printf ("Throwing 2...\n");
31
              throw;
32
            }
33
          catch (A)
34
            {
35
              printf ("Falling out...\n");
36
            }
37
        }
38
    }
39
  catch (A)
40
    {
41
      printf ("Caught.\n");
42
    }
43
  printf ("c == %d, d == %d\n", c, d);
44
  return c != d;
45
}

powered by: WebSVN 2.1.0

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