[Bug libstdc++/83982] [6/7/8/9 Regression] Exception guarantee of C++14 vector::resize(size_type) is not met
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jun 14 09:27:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83982
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Thu Jun 14 09:26:51 2018
New Revision: 261585
URL: https://gcc.gnu.org/viewcvs?rev=261585&root=gcc&view=rev
Log:
PR libstdc++/83982 fix exception-safety guarantee of std::vector::resize
Construct new elements before moving existing ones, so that if a default
constructor throws, the existing elements are not left in a moved-from
state.
2018-06-14 Daniel Trebbien <dtrebbien@gmail.com>
Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/83982
* include/bits/vector.tcc (vector::_M_default_append(size_type)):
Default-construct new elements before moving existing ones.
* testsuite/23_containers/vector/capacity/resize/strong_guarantee.cc:
New.
Added:
trunk/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/strong_guarantee.cc
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/bits/vector.tcc
More information about the Gcc-bugs
mailing list