[libcxx-commits] [libcxx] [libc++] Fix UB in bitwise logic of {std, ranges}::{fill, fill_n} algorithms (PR #122410)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jan 14 09:26:33 PST 2025


================
@@ -20,6 +22,22 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 template <class _Cp, bool _IsConst, typename _Cp::__storage_type = 0>
 class __bit_iterator;
 
+template <class _StorageType, __enable_if_t<is_unsigned<_StorageType>::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _StorageType __leading_mask(unsigned __shift) {
----------------
ldionne wrote:

I think this function was added but it's not used in this patch, is that right? Perhaps we should only add it in the patch where it gets used?

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


More information about the libcxx-commits mailing list