diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2018-07-05 16:56:06 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2018-07-05 16:56:06 +0100 |
commit | d8d9b83b33dd13d81a1e107ce4d1e075a30e6f21 (patch) | |
tree | 0a88c59686cedaf90660aa6b1ff706abecd71692 /gcc | |
parent | 245471c67f3ad27a85dce999933cec1ff298be02 (diff) | |
download | gcc-d8d9b83b33dd13d81a1e107ce4d1e075a30e6f21.zip gcc-d8d9b83b33dd13d81a1e107ce4d1e075a30e6f21.tar.gz gcc-d8d9b83b33dd13d81a1e107ce4d1e075a30e6f21.tar.bz2 |
PR libstdc++/58265 implement LWG 2063 for COW strings
For COW strings the default constructor does not allocate when
_GLIBCXX_FULLY_DYNAMIC_STRING == 0, so can be noexcept. The move
constructor and swap do not allocate when the allocators are equal, so
add conditional noexcept using allocator_traits::is_always_equal.
PR libstdc++/58265
* include/bits/basic_string.h [!_GLIBCXX_USE_CXX11_ABI]
[_GLIBCXX_FULLY_DYNAMIC_STRING==0] (basic_string::basic_string()):
Add GLIBCXX_NOEXCEPT.
(basic_string::operator=(basic_string&&)): Add _GLIBCXX_NOEXCEPT_IF
to depend on the allocator's is_always_equal property (LWG 2063).
(basic_string::swap(basic_string&)): Likewise.
* include/bits/basic_string.tcc [!_GLIBCXX_USE_CXX11_ABI]
(basic_string::swap(basic_string&)): Likewise.
* testsuite/21_strings/basic_string/allocator/char/move_assign.cc:
Check is_nothrow_move_assignable.
* testsuite/21_strings/basic_string/allocator/wchar_t/move_assign.cc:
Check is_nothrow_move_assignable.
* testsuite/21_strings/basic_string/cons/char/
noexcept_move_construct.cc: Likewise.
* testsuite/21_strings/basic_string/cons/wchar_t/
noexcept_move_construct.cc: Likewise.
From-SVN: r262443
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions