Menu

False positive constParameter

2022-01-28
2022-02-11
  • Pierre DEL PERUGIA

    Hi, the following code :

    void f ( std::map< int, int > & m )
    {
       std::cout << m[ 0 ] << std::endl;
    }
    

    reports when enabling style:

    style: Parameter 'm' can be declared with const [constParameter]

    but m cannot be const. Tested with today's HEAD version (2.7 dev).

     
  • CHR

    CHR - 2022-02-11

    Thanks for reporting, this is fixed by https://github.com/danmar/cppcheck/pull/3823

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.