https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83982

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Wed Jul  4 11:44:51 2018
New Revision: 262387

URL: https://gcc.gnu.org/viewcvs?rev=262387&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.

Backport from mainline
2018-06-14  Daniel Trebbien <dtrebb...@gmail.com>
            Jonathan Wakely  <jwak...@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:
   
branches/gcc-8-branch/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/strong_guarantee.cc
Modified:
    branches/gcc-8-branch/libstdc++-v3/ChangeLog
    branches/gcc-8-branch/libstdc++-v3/include/bits/vector.tcc

Reply via email to