This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]