[C++0x] std::exception_ptr rvalues
Jonathan Wakely
jwakely.gcc@gmail.com
Mon Jun 15 19:37:00 GMT 2009
n2884 removed support for swapping with rvalues everywhere in the
library, but I missed exception_ptr::swap() when I changed libstdc++.
The symbol is not exported so it can just be removed.
exception_ptr's move assignment operator doesn't actually move right
now: a temporary is copy-constructed then swapped with *this. This
patch casts the source to an rvalue-reference, ensuring the temporary
is move-constructed instead, avoiding a reference count update.
* libsupc++/exception_ptr.h (exception_ptr::swap(exception_ptr&&)):
Remove.
(exception_ptr::operator=(exception_ptr&&)): Cast source to
rvalue-reference so that move constructor is called.
* testsuite/18_support/exception_ptr/move.cc: New.
As noted in the new file, the test checks for behaviour that is not
required, but is a property of this implementation that I think should
be tested.
Tested x86_64-unknown-linux-gnu, OK for trunk? Should this go on the
4.4. branch too?
Jonathan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eh_ptr.patch
Type: text/x-patch
Size: 2580 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20090615/a83458b6/attachment.bin>
More information about the Libstdc++
mailing list