make the associative containers do the right thing for propogate_on_container_assignment. Fixes bug #29001. Tests are only for <map> right now - more complete tests will come when we revamp our allocator testing structure.
llvm-svn: 279008
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: d4e8659dfc867b678ece220f8ced4c07519630b0
diff --git a/include/__tree b/include/__tree
index bfcec78..b560bf0 100644
--- a/include/__tree
+++ b/include/__tree
@@ -1419,7 +1419,11 @@
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __tree& __t, true_type)
- {__node_alloc() = __t.__node_alloc();}
+ {
+ if (__node_alloc() != __t.__node_alloc())
+ clear();
+ __node_alloc() = __t.__node_alloc();
+ }
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __tree& __t, false_type) {}