This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/61611] Incorrect exception rethrown from a function-try-catch block when a nested try-catch executes
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 25 Jun 2014 15:16:32 +0000
- Subject: [Bug c++/61611] Incorrect exception rethrown from a function-try-catch block when a nested try-catch executes
- Auto-submitted: auto-generated
- References: <bug-61611-4 at http dot gcc dot gnu dot org/bugzilla/>
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.