This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/79254] [5/6/7 Regression] basic_string::operator= isn't exception safe
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 01 Feb 2017 11:42:20 +0000
- Subject: [Bug libstdc++/79254] [5/6/7 Regression] basic_string::operator= isn't exception safe
- Auto-submitted: auto-generated
- References: <bug-79254-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79254
--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Wed Feb 1 11:41:48 2017
New Revision: 245085
URL: https://gcc.gnu.org/viewcvs?rev=245085&root=gcc&view=rev
Log:
PR libstdc++/79254 simplify exception-safety in copy assignment
PR libstdc++/79254
* config/abi/pre/gnu.ver: Remove recently added symbols.
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
(basic_string::_M_copy_assign): Remove.
(basic_string::operator=(const basic_string&)): Don't dispatch to
_M_copy_assign. If source object is small just deallocate, otherwise
perform new allocation before making any changes.
* include/bits/basic_string.tcc [_GLIBCXX_USE_CXX11_ABI]
(basic_string::_M_copy_assign(const basic_string&, true_type)):
Remove.
* testsuite/21_strings/basic_string/allocator/char/copy_assign.cc:
Test cases where the allocators are equal or the string is small.
* testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc:
Likewise.
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/config/abi/pre/gnu.ver
trunk/libstdc++-v3/include/bits/basic_string.h
trunk/libstdc++-v3/include/bits/basic_string.tcc
trunk/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/copy_assign.cc
trunk/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc