[llvm-bugs] [Bug 46565] New: -Wrange-loop-analysis for algorithms
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jul 2 13:56:51 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46565
Bug ID: 46565
Summary: -Wrange-loop-analysis for algorithms
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: trass3r at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
using Map = std::map<int, std::vector<std::string>>;
void wrong1(const Map& m)
{
for (const std::pair<int, std::vector<std::string>>& p : m)
{}
}
void wrong2(const Map& m)
{
std::for_each(m.begin(), m.end(), [](const std::pair<int,
std::vector<std::string>> p){
});
}
The warning catches the first case but not the second:
https://godbolt.org/z/E-LCJV
If that analysis is not too expensive it could also warn about iteration done
by various algorithms.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200702/c2db39b0/attachment-0001.html>
More information about the llvm-bugs
mailing list