 <p>cppcheck is largely based on pattern matching and is not too smart / quite shallow at times. It <em>does</em> find a bunch of nice stuff but also has a <em>lot</em> of false positives. I'd say this is a false positive where cppchecks simple mind got confused.</p> <p>Also; version 1.61 is a bit old. Have you tested the latest 1.74 to see if it is more clever here? (It's quite simple to build from source if it is not in your distributions repository)</p>