I can't reproduce this when calling cppcheck.exe .\foo.cpp --enable=all --inconclusive on the code above. Maybe some more code is needed for the warning to be triggered?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Code :
mapwill be modified ifpanelis found on any of its values.It should not be declared const.
cppcheck version : 2.4.1
Last edit: Roy 2021-04-27
I can't reproduce this when calling
cppcheck.exe .\foo.cpp --enable=all --inconclusiveon the code above. Maybe some more code is needed for the warning to be triggered?Updated :
Can repro with
cppcheck.exe foo.cpp --enable=all --inconclusiveIt seems the problem is related to C++17 structured binding. Slightly reduced example:
This is clean:
Also, the warning disappears when a namespace is added to the function (
slave_scanning_set::in the OP)Thanks! I can reproduce. I created https://trac.cppcheck.net/ticket/10266