[libcxx-commits] [libcxx] [libc++] Make forward_list constexpr as part of P3372R3 (PR #129435)
Peng Liu via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Mar 6 21:00:57 PST 2025
================
@@ -295,9 +295,12 @@ struct __forward_node_traits {
"the _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB macro to silence this diagnostic.");
# endif
- _LIBCPP_HIDE_FROM_ABI static __begin_node_pointer __as_iter_node(__begin_node_pointer __p) { return __p; }
- _LIBCPP_HIDE_FROM_ABI static __begin_node_pointer __as_iter_node(__node_pointer __p) {
- return static_cast<__begin_node_pointer>(static_cast<__void_pointer>(__p));
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI static __begin_node_pointer
+ __as_iter_node(__begin_node_pointer __p) {
+ return __p;
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI static __begin_node_pointer __as_iter_node(__node_pointer __p) {
+ return std::__static_fancy_pointer_cast<__begin_node_pointer>(__p);
----------------
winner245 wrote:
The old version fails in constant evaluation. I fixed it without resorting to the `void*` pointer. Given that the redundant `__as_iter_node` identity cast has already been fixed for `forward_list`, is there anything else that needs to be addressed before this patch is landed? I've just rebased the patch to resolve conflicts due to the removal of `__as_iter_node`.
https://github.com/llvm/llvm-project/pull/129435
More information about the libcxx-commits
mailing list