[Bug libstdc++/41174] uncaught_exception always returns true
wwashby at earthlink dot net
gcc-bugzilla@gcc.gnu.org
Sat Aug 29 11:27:00 GMT 2009
------- Comment #12 from wwashby at earthlink dot net 2009-08-29 11:27 -------
(In reply to comment #11)
> (In reply to comment #10)
> >
> > I'm not sure that this applies in this situation. An instance of BadE is
> > constructed because it is thrown, but BadE::BadE does not "[exit] via an
> > uncaught exception". It both throws and catches an exception, and then returns
> > normally. There is still an uncaught exception when BadE::BadE exits, but it
> > is the one that caused BadE to be constructed, not the one that BadE::BadE has
> > thrown (and caught).
>
> No, in [except.handle]/16 the standard says
>
> "The exception being handled is rethrown if control reaches the end of a
> handler of the function-try-block of a constructor or destructor."
>
> You cannot swallow exceptions in a constructor's function-try-block, they will
> be rethrown.
>
> >
>
1,000 apologies, of course you are right; my own code and shows that (blush).
Maybe uncaught_exception assumes that the throw BadE will succeed and doesn't
notice that the BadE object is not fully constructed?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41174
More information about the Gcc-bugs
mailing list