This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/40296] [C++0x] std::exception_ptr comparisons
- From: "jwakely dot gcc at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Jun 2009 09:30:25 -0000
- Subject: [Bug libstdc++/40296] [C++0x] std::exception_ptr comparisons
- References: <bug-40296-5876@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from jwakely dot gcc at gmail dot com 2009-06-03 09:30 -------
(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 also noticed the move-assignment operator adds no value:
#ifdef __GXX_EXPERIMENTAL_CXX0X__
exception_ptr&
operator=(exception_ptr&& __o) throw()
{
exception_ptr(__o).swap(*this);
return *this;
}
#endif
That should be
exception_ptr(static_cast<exception_ptr&&>(__o)).swap(*this);
because otherwise the temporary is copy-constructed, not move-constructed, and
therefore the effect is identical to the lvalue assignment operator,
incrementing and decrementing the refcount.
(static_cast to rvalue-reference must be used, because std::move() is not
available in libsupc++)
I'll fix that separately, as part of a forthcoming patch implementing n2844.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40296