[libcxx-commits] [libcxx] f735aa0 - [libc++] Tighten `__add_alignment_assumption` return type (#180090)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Feb 6 05:26:42 PST 2026
Author: Christopher Di Bella
Date: 2026-02-06T08:26:37-05:00
New Revision: f735aa061b4c2df5462285583eb8aaa134476b53
URL: https://github.com/llvm/llvm-project/commit/f735aa061b4c2df5462285583eb8aaa134476b53
DIFF: https://github.com/llvm/llvm-project/commit/f735aa061b4c2df5462285583eb8aaa134476b53.diff
LOG: [libc++] Tighten `__add_alignment_assumption` return type (#180090)
`__add_alignment_assumption` unilaterally returned a `pointer`, even
when passed a `const_pointer`. This was surfaced by some (but not all)
CI jobs when rebasing `std::vector` to have a layout type.
Added:
Modified:
libcxx/include/__vector/vector.h
Removed:
################################################################################
diff --git a/libcxx/include/__vector/vector.h b/libcxx/include/__vector/vector.h
index b5d49e20dc875..9747575bedafc 100644
--- a/libcxx/include/__vector/vector.h
+++ b/libcxx/include/__vector/vector.h
@@ -808,16 +808,16 @@ class vector {
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(vector&, false_type) _NOEXCEPT {}
template <class _Ptr = pointer, __enable_if_t<is_pointer<_Ptr>::value, int> = 0>
- static _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI pointer
+ static _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _Ptr
__add_alignment_assumption(_Ptr __p) _NOEXCEPT {
if (!__libcpp_is_constant_evaluated()) {
- return static_cast<pointer>(__builtin_assume_aligned(__p, _LIBCPP_ALIGNOF(decltype(*__p))));
+ return static_cast<_Ptr>(__builtin_assume_aligned(__p, _LIBCPP_ALIGNOF(decltype(*__p))));
}
return __p;
}
template <class _Ptr = pointer, __enable_if_t<!is_pointer<_Ptr>::value, int> = 0>
- static _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI pointer
+ static _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _Ptr
__add_alignment_assumption(_Ptr __p) _NOEXCEPT {
return __p;
}
More information about the libcxx-commits
mailing list