Skip to content

Commit 3daa6c5

Browse files
committed
Address review comments
1 parent 94c2ede commit 3daa6c5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

libcxx/include/__vector/vector.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -780,8 +780,13 @@ class _LIBCPP_TEMPLATE_VIS vector {
780780

781781
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(vector&, false_type) _NOEXCEPT {}
782782

783-
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer __add_alignment_assumption(pointer __p) const _NOEXCEPT {
784-
return static_cast<pointer>(__builtin_assume_aligned(__p, alignof(decltype(*__p))));
783+
static _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer __add_alignment_assumption(pointer __p) _NOEXCEPT {
784+
if constexpr (is_pointer<pointer>::value) {
785+
if (!__libcpp_is_constant_evaluated()) {
786+
return static_cast<pointer>(__builtin_assume_aligned(__p, alignof(decltype(*__p))));
787+
}
788+
}
789+
return __p;
785790
}
786791
};
787792

0 commit comments

Comments
 (0)