parent
ad34a822c1
commit
d0029fc5be
|
@ -0,0 +1,24 @@
|
|||
// Test that inlining a destructor with a catch block doesn't confuse the
|
||||
// enclosing try block.
|
||||
// Special g++ Options: -O
|
||||
|
||||
struct A {
|
||||
~A()
|
||||
{
|
||||
try { throw 1; }
|
||||
catch (...) { }
|
||||
}
|
||||
};
|
||||
|
||||
int main ()
|
||||
{
|
||||
try
|
||||
{
|
||||
A a;
|
||||
throw 42;
|
||||
}
|
||||
catch (int i)
|
||||
{
|
||||
return (i != 42);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
// Test that an unhandled exception causes us to call terminate.
|
||||
|
||||
#include <exception>
|
||||
#include <cstdlib>
|
||||
|
||||
void my_terminate ()
|
||||
{
|
||||
std::exit (0);
|
||||
}
|
||||
|
||||
int main (void)
|
||||
{
|
||||
std::set_terminate (my_terminate);
|
||||
throw 1;
|
||||
return 1;
|
||||
}
|
Loading…
Reference in New Issue