[PATCH] Fix std::uncaught_exception() to return true during exception initialization
Mark Seaborn
mseaborn at chromium.org
Thu Dec 12 09:57:36 PST 2013
On 11 December 2013 15:41, Howard Hinnant <howard.hinnant at gmail.com> wrote:
> On Dec 9, 2013, at 4:42 PM, Mark Seaborn <mseaborn at chromium.org> wrote:
> > Hi howard.hinnant,
> >
> > Fix std::uncaught_exception() to return true during exception
> initialization
> >
> > std::uncaught_exception() should return true during the call to the
> > copy constructor that "throw X" does to initialize the exception
> > object after the expression X has been evaluated (or during the call
> > to the normal constructor if the compiler has done copy elision).
>
> It appears to me that that CWG 475 (
> http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#475) decided
> in April 2006 the opposite direction of the fix made to gcc implemented a
> year earlier.
>
> The current draft retains the wording from CWG 475 (15.5.3/p1):
>
> > The function std::uncaught_exception() returns true *after* completing
> the initialization of the exception object...
>
> (I added the emphasis)
>
> The current output of your test on OS X:
>
> std::uncaught_exception()=0
>
> appears to me to be the standard conforming output.
OK, that makes sense. Particularly since an exception that occurs in the
throw's call to the copy constructor is catchable, unlike an exception that
occurs in a catch's call to a copy constructor. The intention seems to be
that std::uncaught_exception() returns true in contexts where any exception
would be uncatchable by an outer "try" block.
Thanks for checking. I'll close the issue (PR18193).
Cheers,
Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131212/40adb010/attachment.html>
More information about the cfe-commits
mailing list