[libcxx-commits] [libcxx] [libc++] Take the ABI break for `std::list`'s pointer UB unconditionally (PR #100585)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 12 09:48:44 PDT 2024


================
@@ -77,11 +77,17 @@ struct __hash_node_base {
   typedef __hash_node_base __first_node;
   typedef __rebind_pointer_t<_NodePtr, __first_node> __node_base_pointer;
   typedef _NodePtr __node_pointer;
-
-#if defined(_LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB)
   typedef __node_base_pointer __next_pointer;
-#else
-  typedef __conditional_t<is_pointer<__node_pointer>::value, __node_base_pointer, __node_pointer> __next_pointer;
+
+#ifndef _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB
+  static_assert(sizeof(__node_base_pointer) == sizeof(__node_pointer) && _LIBCPP_ALIGNOF(__node_base_pointer) ==
+                    _LIBCPP_ALIGNOF(__node_pointer),
+                "It looks like you are using std::__hash_table (an implementation detail for the unordered containers) "
+                "with a fancy pointer type that thas a different representation depending on whether it points to a "
+                "__tree base pointer or a __tree node pointer (both of which are implementation details of the "
----------------
ldionne wrote:

```suggestion
                "__hash_table base pointer or a __hash_table node pointer (both of which are implementation details of the "
```

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


More information about the libcxx-commits mailing list