https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79254
--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> --- Author: redi Date: Wed Feb 1 12:12:28 2017 New Revision: 245086 URL: https://gcc.gnu.org/viewcvs?rev=245086&root=gcc&view=rev Log: PR libstdc++/79254 fix exception-safety of std::string copy assignment PR libstdc++/79254 * include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI] (basic_string::operator=(const basic_string&)): If source object is small just deallocate, otherwise perform new allocation before making any changes. * testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc: Test exception-safety of copy assignment when allocator propagates. * testsuite/21_strings/basic_string/allocator/char/copy_assign.cc: Likewise. * testsuite/util/testsuite_allocator.h (uneq_allocator::swap): Make std::swap visible. Modified: branches/gcc-6-branch/libstdc++-v3/ChangeLog branches/gcc-6-branch/libstdc++-v3/include/bits/basic_string.h branches/gcc-6-branch/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/copy_assign.cc branches/gcc-6-branch/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc branches/gcc-6-branch/libstdc++-v3/testsuite/util/testsuite_allocator.h