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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [eh/] [spec10.C] - Blame information for rev 801

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

Line No. Rev Author Line
1 693 jeremybenn
// Make sure that we call terminate when a throw() spec is violated even
2
// with -fnothrow-opt.  The function pointers are there to make sure that
3
// the compiler doesn't get clever about optimizing the calls based on
4
// knowledge about the called functions.
5
 
6
// { dg-options "-fnothrow-opt" }
7
// { dg-do run }
8
 
9
#include 
10
#include 
11
 
12
void my_terminate ()
13
{
14
  std::exit (0);
15
}
16
 
17
void g() { throw 1; }
18
void (*p1)() = g;
19
void f() throw() { p1(); }
20
void (*p2)() = f;
21
void h() { p2(); }
22
 
23
int main()
24
{
25
  std::set_terminate (my_terminate);
26
 
27
  try { h(); }
28
  catch (int) { }
29
 
30
  return 1;
31
}

powered by: WebSVN 2.1.0

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