PR libstdc++/83982 fix exception-safety guarantee of std::vector::resize
commit778960f7f393c010d689b964ba3c26c2cd0202bd
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 14 Jun 2018 09:26:51 +0000 (14 09:26 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 14 Jun 2018 09:26:51 +0000 (14 09:26 +0000)
treea759ed4858add51262b507d4cd3eb47b79f73fad
parent02727084b4ecce0f61c2cdc7955f2cc14945a92f
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@261585 138bc75d-0d04-0410-961f-82ee72b054a4
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/vector.tcc
libstdc++-v3/testsuite/23_containers/vector/capacity/resize/strong_guarantee.cc [new file with mode: 0644]