On 03/07/20 08:37 +0200, François Dumont via Libstdc++ wrote:
Hi
   Here is the patch to fix the 2nd point of this mail below.
   I prefer to qualify _Rb_tree_impl move constructor based on
std::is_nothrow_move_constructible<_Base_key_compare> so that the
logic of copying _Compare rather than moving it stays an
implementation detail of _Rb_tree_key_compare.
   libstdc++: Fix [multi]map/[multi]set move constructors noexcept
qualification
   Container move constructors shall not consider their allocator move
   constructor qualification.
   libstdc++-v3/ChangeLog:
           * include/bits/stl_tree.h
(_Rb_tree_impl(_Rb_tree_impl&&)): Add noexcept
           qualification based only on _Compare one.
           *
testsuite/23_containers/map/cons/noexcept_move_construct.cc: Add
           static asserts.
           *
testsuite/23_containers/multimap/cons/noexcept_move_construct.cc:
           Likewise.
           *
testsuite/23_containers/multiset/cons/noexcept_move_construct.cc:
           Likewise.
           *
testsuite/23_containers/set/cons/noexcept_move_construct.cc: Likewise.
New tests run under Linux x86_64, ok to commit after other tests complete ?
[...]
diff --git a/libstdc++-v3/include/bits/stl_tree.h
b/libstdc++-v3/include/bits/stl_tree.h
index 39303c47b08..d7f5439f452 100644
--- a/libstdc++-v3/include/bits/stl_tree.h
+++ b/libstdc++-v3/include/bits/stl_tree.h
@@ -706,7 +706,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: _Node_allocator(__a), _Base_key_compare(__comp)
{ }
#else
- _Rb_tree_impl(_Rb_tree_impl&&) = default;
+ _Rb_tree_impl(_Rb_tree_impl&&)
+ noexcept(
+ std::is_nothrow_move_constructible<_Base_key_compare>::value )
+ = default;
If you remove the redundant "std::" this will fit on one line.
OK for master with that change, thanks.
I need to check which branches will allow the noexcept-specifier on a
defaulted constructor. I don't think we can backport it to all
branches.