Issue 130684
Summary [clang-tidy] Invalid fixit from modernize-use-ranges for equality-comparable types
Labels clang-tidy
Assignees
Reporter chrchr-github
    From https://github.com/llvm/llvm-project/issues/124815:
~~~c++
#include <vector>
#include <algorithm>
#include <ranges>

struct S {
    int i{};
    bool operator==(int rhs) const { return i == rhs; }
};

bool f(const std::vector<S>& v) {
    auto it = std::find(v.begin(), v.end(), 0);
    // auto it = std::ranges::find(v, 0); // invalid
    return it == v.end();
}
~~~
https://godbolt.org/z/jjK8bfKrT
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to