Open srpgilles opened 1 month ago
Just fyi, the proposed fix should be auto [logical_end, _] = std::ranges::unique(indexes);
Returns {ret, last}, where ret is a past-the-end iterator for the new end of the range.
https://en.cppreference.com/w/cpp/algorithm/ranges/unique
Many thanks for pointing this out!
As a matter of fact I did the homework for std::ranges::copy, where it is really the second on that should be taken, and I assumed - wrongly it appears! - that it would be the same kind of object returned.
@llvm/issue-subscribers-clang-tidy
Author: None (srpgilles)
@llvm/issue-subscribers-bug
Author: None (srpgilles)
If I run clang-tidy v19.1.0 from Homebrew on macOS / XCode 16 over this small snippet:
I get the following code:
which is incorrect as
std::ranges::unique
returns astd::ranges::in_out_result
(I got the same mistake withstd::ranges::copy
).Replacing the generated:
by:
would fix it.
At any rate, thanks a lot for this extremely useful new diagnostic: I upgraded my whole codebase in less than 30 minutes 🙂