Fix PR22366. When move-constructing an associative container and explicitly passing an allocator that compares different, we were not calling the destructor of the elements in the moved-from container.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227359 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/__tree b/include/__tree
index 8e5447a..401891b 100644
--- a/include/__tree
+++ b/include/__tree
@@ -522,9 +522,9 @@
bool __value_constructed;
_LIBCPP_INLINE_VISIBILITY
- explicit __tree_node_destructor(allocator_type& __na) _NOEXCEPT
+ explicit __tree_node_destructor(allocator_type& __na, bool __val = false) _NOEXCEPT
: __na_(__na),
- __value_constructed(false)
+ __value_constructed(__val)
{}
_LIBCPP_INLINE_VISIBILITY
@@ -2291,7 +2291,7 @@
--size();
__tree_remove(__end_node()->__left_,
static_cast<__node_base_pointer>(__np));
- return __node_holder(__np, _Dp(__node_alloc()));
+ return __node_holder(__np, _Dp(__node_alloc(), true));
}
template <class _Tp, class _Compare, class _Allocator>