[Bug libstdc++/40296] [C++0x] std::exception_ptr comparisons
tfautre at pandora dot be
gcc-bugzilla@gcc.gnu.org
Wed Jun 2 16:54:00 GMT 2010
------- Comment #10 from tfautre at pandora dot be 2010-06-02 16:54 -------
(In reply to comment #5)
> (In reply to comment #1)
> > I'm under the impression we should simply not provide operator __safe_bool()
>
> Agreed, there is no requirement for conversion to bool, explicit or implicit.
> Even if it can be done unambiguously, adding that non-standard conversion would
> encourage non-portable code. I think operator! should be removed for the same
> reason.
I disagree with that statement (the draft may have changed since your comment
was made).
In the latest C++0x draft,
Section 18.8.5: "exception_ptr shall satisfy the requirements of
NullablePointer (20.2.3)."
Section 20.2.3 (NullablePointer Requirements): "An object p of type P can be
contextually converted to bool (Clause 4). The effect shall be as if p !=
nullptr had been evaluated in place of p."
AFAIK, the following code should work but does not anymore cause of this bug
fix:
std::exception_ptr e;
if (e)
{
/* ... */
}
--
tfautre at pandora dot be changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tfautre at pandora dot be
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40296
More information about the Gcc-bugs
mailing list