[libcxx-commits] [libcxx] [libc++] Fix ambiguous call to std::max in vector<bool> (PR #119801)

Peng Liu via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jan 9 07:51:32 PST 2025


winner245 wrote:

It appears that my added tests for `size_allocator<T, SIZE_TYPE, DIFF_TYPE>` have triggered a new bug in all the `__bit_iterator` algorithms, including `std::{copy, copy_n, copy_backward, fill, fill_n, find, count}` and their `ranges` algorithm equivalents. The bug is essentially caused by an integral promotion of unsigned integral types (`std::uint8_t`, `std::uint16_t`) to signed `int`, followed by a left shift of the signed negative values, which is UB before C++20. Additionally, there are also some undesired integral promotions of small unsigned integral types to `int`, followed by right-shifts, which are implementation-defined before C++20. Therefore, we need to fix this new bug in these algorithms as well.

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


More information about the libcxx-commits mailing list