[libcxx-commits] [libcxx] [libc++] Make forward_list constexpr as part of P3372R3 (PR #129435)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed May 28 09:44:27 PDT 2025
================
@@ -498,48 +508,53 @@ protected:
_LIBCPP_COMPRESSED_PAIR(__begin_node, __before_begin_, __node_allocator, __alloc_);
- _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __before_begin() _NOEXCEPT {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __before_begin() _NOEXCEPT {
return pointer_traits<__begin_node_pointer>::pointer_to(__before_begin_);
}
- _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __before_begin() const _NOEXCEPT {
- return pointer_traits<__begin_node_pointer>::pointer_to(const_cast<__begin_node&>(__before_begin_));
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __before_begin() const _NOEXCEPT {
+ return pointer_traits<__begin_node_pointer>::pointer_to(
+ *const_cast<__begin_node*>(std::addressof(__before_begin_)));
----------------
ldionne wrote:
Can we verify whether we have existing tests for fancy pointers in `std::forward_list`? It would be a shame if this patch had the unintended side effect of breaking that use case and we didn't notice because we're lacking coverage.
https://github.com/llvm/llvm-project/pull/129435
More information about the libcxx-commits
mailing list