]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR libstdc++/79254 fix exception-safety of std::string copy assignment
authorJonathan Wakely <jwakely@redhat.com>
Wed, 1 Feb 2017 12:18:43 +0000 (12:18 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 1 Feb 2017 12:18:43 +0000 (12:18 +0000)
commit26722ba9572c6d5124ae44ad9f0a304554668344
tree5e7e05c00f9c9fedf8c2f9a9b930faaa2184235a
parente46bd39e36e2d914e050416b6e5817da885c42f9
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.

From-SVN: r245088
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/basic_string.h
libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/copy_assign.cc
libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc
libstdc++-v3/testsuite/util/testsuite_allocator.h