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

Richard Smith via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 11 18:01:45 PDT 2025


================
@@ -1053,8 +965,8 @@ public:
 
 private:
   typedef __hash_value_type<key_type, mapped_type> __value_type;
-  typedef __unordered_map_hasher<key_type, __value_type, hasher, key_equal> __hasher;
-  typedef __unordered_map_equal<key_type, __value_type, key_equal, hasher> __key_equal;
+  typedef __unordered_map_hasher<key_type, value_type, hasher, key_equal> __hasher;
+  typedef __unordered_map_equal<key_type, value_type, key_equal, hasher> __key_equal;
   typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type;
----------------
zygoloid wrote:

This is rebinding the user-supplied allocator to an incomplete type, which I don't think is allowed in general (allocators aren't required to support incomplete element types, which is implied by there being [special rules that apply only if they do](https://eel.is/c++draft/allocator.requirements.completeness)). This is resulting in build failures for us.

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


More information about the libcxx-commits mailing list