[Bug c++/61611] Incorrect exception rethrown from a function-try-catch block when a nested try-catch executes
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jun 25 15:16:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61611
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-06-25
Ever confirmed|0 |1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Brad Spencer from comment #0)
> Perhaps _all_ catch blocks (including nested catch blocks) in a constructor
> function try-catch are rethrowing when control reaches the end of them
> instead of only the catch blocks of the actual constructor function
> try-catch structure.
Yes, that seems to be the case.
> Apologies for the non-preprocessed test file, but it does use only standard
> headers.
That's fine, but personally I find it more useful if the testcase shows the bug
by default, and a macro is needed to make it pass.
Reduced:
struct A { };
struct B { };
class Test
{
public:
Test()
try
{
throw A();
}
catch(const A&)
{
try
{
throw B();
} catch(const B&) {
}
}
};
int
main()
{
try
{
Test x;
}
catch(const A&)
{
}
}
This should terminate normally.
More information about the Gcc-bugs
mailing list