[Bug libstdc++/80579] std::vector<T>::reserve should not require T to be moveable.
ville.voutilainen at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Apr 30 21:39:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80579
Ville Voutilainen <ville.voutilainen at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ville.voutilainen at gmail dot com
Component|c++ |libstdc++
--- Comment #1 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
Well, clang 5.0 on wandbox rejects the code:
https://wandbox.org/permlink/W6hDjCOfqNRecpnU
vector::reserve requires MoveInsertable(*), B isn't MoveInsertable.
This is not an implementation bug, libstdc++ conforms to what the
standard specifies.
(*) ..because reserve might reallocate, so if it does, the elements
need to be moved to a new buffer. An implementation is not required
to copy the elements if moving them isn't valid, quite the opposite;
an implementation is allowed to assume that it can move. We could
be really nice and do that as a response to the violation of the
MoveInsertable precondition.
More information about the Gcc-bugs
mailing list