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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.eh/] [rethrow3.C] - Rev 823

Go to most recent revision | Compare with Previous | Blame | View Log

// { dg-do run  }
#include <stdio.h>
#include <stdlib.h>
#include <exception>

static void
eh_terminate ()
{
  printf ("CALLING TERMINATE\n");
  exit (1);
}

void
eh_test (int level)
{
  try
    {
      if (level < 2)
        eh_test (level + 1);
      else
        {
          printf ("%d: Throwing\n", level);
          throw (level);
        }
    }
  catch (int &x)
    {
      printf ("%d: Got level %d\n",
              level, x);

      if (level > 0)
        throw;
    }
}

int main ()
{
  std::set_terminate (&eh_terminate);
  eh_test (0);
}

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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