Given the following code
std::map<std::sting, std::vector<std::string>> map; void test(){ for(const auto &entry : map){ auto& names = entry.second; for(auto &name : names) { std::cout << name << std::endl; } } }
I got
example_const_ref.cpp:5:19: style: Variable 'name' can be declared as reference to const [constVariableReference] for(auto &name : names) { ^
before https://github.com/danmar/cppcheck/commit/6fc4d3624ba47de14f59244ec5fe9e5550f68309 but with this commit the warning is not reported anymore (which is wrong).
Thanks.
Confirmed and filed as https://trac.cppcheck.net/ticket/13925.
Log in to post a comment.
Given the following code
I got
before https://github.com/danmar/cppcheck/commit/6fc4d3624ba47de14f59244ec5fe9e5550f68309
but with this commit the warning is not reported anymore (which is wrong).
Thanks.
Confirmed and filed as https://trac.cppcheck.net/ticket/13925.