Menu

False positive - style/constParameter

2020-09-07
2020-09-07
  • jeniffer1234

    jeniffer1234 - 2020-09-07

    Minimum working example.

    #include <vector>
    #include <boost/foreach.hpp>
    
    namespace
    {
    struct Test
    {};
    }
    
    void Test2(std::vector<Test>& first, std::vector<Test*>& second)
    {
       BOOST_FOREACH(Test& test, first)
       {
          second.push_back(boost::addressof<Test>(test));
       }
    }
    

    Cppcheck output:
    style/constParameter: Parameter 'first' can be declared with const

     
  • Daniel Marjamäki

    Please try --library=boost.

     

Log in to post a comment.