URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
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;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.