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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.eh/] [rethrow5.C] - Diff between revs 305 and 338

Only display areas with differences | Details | Blame | View Log

Rev 305 Rev 338
// { dg-do run  }
// { dg-do run  }
// Testcase for proper handling of rethrow.
// Testcase for proper handling of rethrow.
#include 
#include 
int c, d;
int c, d;
struct A
struct A
{
{
  int i;
  int i;
  A () { i = ++c; printf ("A() %d\n", i); }
  A () { i = ++c; printf ("A() %d\n", i); }
  A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); }
  A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); }
  ~A() { printf ("~A() %d\n", i); ++d; }
  ~A() { printf ("~A() %d\n", i); ++d; }
};
};
int
int
main ()
main ()
{
{
  try
  try
    {
    {
      try
      try
        {
        {
          printf ("Throwing 1...\n");
          printf ("Throwing 1...\n");
          throw A();
          throw A();
        }
        }
      catch (A)
      catch (A)
        {
        {
          try
          try
            {
            {
              printf ("Throwing 2...\n");
              printf ("Throwing 2...\n");
              throw;
              throw;
            }
            }
          catch (A)
          catch (A)
            {
            {
              printf ("Falling out...\n");
              printf ("Falling out...\n");
            }
            }
        }
        }
    }
    }
  catch (A)
  catch (A)
    {
    {
      printf ("Caught.\n");
      printf ("Caught.\n");
    }
    }
  printf ("c == %d, d == %d\n", c, d);
  printf ("c == %d, d == %d\n", c, d);
  return c != d;
  return c != d;
}
}
 
 

powered by: WebSVN 2.1.0

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