[libcxx-commits] [libcxx] [libc++] Avoid type-punning between __hash_value_type and pair (PR #143501)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 18 08:41:03 PDT 2025


================
@@ -1680,9 +1589,8 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(unordered_map&& __
     : __table_(std::move(__u.__table_), typename __table::allocator_type(__a)) {
   if (__a != __u.get_allocator()) {
     iterator __i = __u.begin();
-    while (__u.size() != 0) {
-      __table_.__emplace_unique(__u.__table_.remove((__i++).__i_)->__get_value().__move());
-    }
+    while (__u.size() != 0)
+      __table_.__insert_multi_from_orphaned_node(std::move(__u.__table_.remove((__i++).__i_)->__get_value()));
----------------
ldionne wrote:

Is this really what you meant? Shouldn't this be `__insert_unique_from_orphaned_node`?

If so, we should have a test.

https://github.com/llvm/llvm-project/pull/143501


More information about the libcxx-commits mailing list