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
Showing
Please
register
or
sign in
to comment