Found in cppcheck 2.22
Running cppcheck --enable=style --std=c++17 --template=gcc repro.cpp
cppcheck --enable=style --std=c++17 --template=gcc repro.cpp
on
#include <functional> #include <vector> struct Item {}; void example() { Item value; auto& ref = value; std::vector<std::reference_wrapper<Item>> refs{ref}; }
gives Variable 'ref' can be declared as reference to const [constVariableReference]
Variable 'ref' can be declared as reference to const [constVariableReference]
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/15103
Log in to post a comment.
Found in cppcheck 2.22
Running
cppcheck --enable=style --std=c++17 --template=gcc repro.cppon
gives
Variable 'ref' can be declared as reference to const [constVariableReference]Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/15103