modernize-use-ranges false positive for std::fill on std::vector<bool>
Open
clang-tidy
false-positive
invalid-code-generation
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
clang-tidy version 22.1.3 for C++20 recommends to use a ranges algorithm to fill a `std::vector`:
```
#include
int main() {
std::vector v(10);
// Fill the entire range with true
std::fill(v.begin(), v.end(), true); // warning: use a ranges version of this algorithm [modernize-use-ranges]
}
```
The `std::ranges::fill` algorithm, however, cannot be used with `std::vector` in C++20.
https://godbolt.org/z/evj8r8azW
Contributor guide
Assessment
This issue has not been assessed yet.