[all-commits] [llvm/llvm-project] e53bea: [libc++] Fix ambiguous call in {ranges, std}::coun...
Peng Liu via All-commits
all-commits at lists.llvm.org
Wed Mar 19 08:36:52 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e53bea51829ee9876a2010fec1a13d740533b89a
https://github.com/llvm/llvm-project/commit/e53bea51829ee9876a2010fec1a13d740533b89a
Author: Peng Liu <winner245 at hotmail.com>
Date: 2025-03-19 (Wed, 19 Mar 2025)
Changed paths:
M libcxx/include/__algorithm/count.h
M libcxx/include/__bit/popcount.h
M libcxx/test/std/algorithms/alg.nonmodifying/alg.count/count.pass.cpp
M libcxx/test/std/algorithms/alg.nonmodifying/alg.count/ranges.count.pass.cpp
Log Message:
-----------
[libc++] Fix ambiguous call in {ranges, std}::count (#122529)
This PR fixes an ambiguous call encountered while using the
`std::ranges::count` and `std::count` algorithms with `vector<bool>`
with small `size_type`s.
The ambiguity arises from integral promotions during the internal
bitwise arithmetic of the `count` algorithms for small integral types.
This results in multiple viable candidates:
`__libcpp_popcount(unsigned)`,` __libcpp_popcount(unsigned long)`, and
`__libcpp_popcount(unsigned long long)`, leading to an ambiguous call
error. To resolve this ambiguity, we introduce a dispatcher function,
`__popcount`, which directs calls to the appropriate overloads of
`__libcpp_popcount`. This closes #122528.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list