Hi, I found a false positive / malformed warning regarding the rule accessMoved.
In the following program, cppcheck correctly reports that s is accessed after std::move(s). However, it also reports an extra accessMoved warning for the symbol :, which is not a variable.
<errorid="accessMoved"severity="warning"msg="Access of moved variable ':'."...><symbol>:</symbol></error><errorid="accessMoved"severity="warning"msg="Access of moved variable 's'."...><symbol>s</symbol></error>
The warning for s is expected, but the warning for : is incorrect because : is only the range-for syntax token.
Expected result
Cppcheck should only report accessMoved for s, not for :.
Hi, I found a false positive / malformed warning regarding the rule
accessMoved.In the following program, cppcheck correctly reports that
sis accessed afterstd::move(s). However, it also reports an extraaccessMovedwarning for the symbol:, which is not a variable.Actual result
Cppcheck reports two
accessMovedwarnings:The warning for
sis expected, but the warning for:is incorrect because:is only the range-for syntax token.Expected result
Cppcheck should only report
accessMovedfors, not for:.Verification
The issue was reproduced with:
Version: 2.21.0
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/14928