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

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 7 08:53:33 PDT 2025


================
@@ -2100,7 +2036,8 @@ multimap<_Key, _Tp, _Compare, _Allocator>::multimap(multimap&& __m, const alloca
   if (__a != __m.get_allocator()) {
     const_iterator __e = cend();
     while (!__m.empty())
-      __tree_.__insert_multi(__e.__i_, std::move(__m.__tree_.remove(__m.begin().__i_)->__value_.__move()));
+      __tree_.__insert_multi(
+          __e.__i_, reinterpret_cast<pair<_Key, _Tp>&&>(__m.__tree_.remove(__m.begin().__i_)->__value_));
----------------
ldionne wrote:

Ditto for `reinterpret_cast`.

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


More information about the libcxx-commits mailing list