[Bug libstdc++/40296] [C++0x] std::exception_ptr comparisons

jwakely dot gcc at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Jun 2 17:27:00 GMT 2010



------- Comment #14 from jwakely dot gcc at gmail dot com  2010-06-02 17:26 -------
(In reply to comment #10)
> AFAIK, the following code should work but does not anymore cause of this bug
> fix:
> 
> std::exception_ptr e;
> 
> if (e)
> {
>     /* ... */
> }

I'm fairly sure that's not valid.
That relies on an implicit conversion to bool, not a contextual conversion to
bool, and 18.8.5 also says "exception_ptr shall not be implicitly convertible
to any arithmetic, enumeration, or pointer type." 

This should work though:
   if (bool(e))
I'll fix that and add tests to check implicit conversions don't work (I think
that requirement is also new since exception_ptr was last worked on.)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40296



More information about the Gcc-bugs mailing list