AI review of 2026-10-22_09-21-03-74b89d2779d2-results.txt PR: #8918 https://github.com/cppcheck-opensource/cppcheck/pull/8918 Tested: 74b89d2779d2d48cb473bcfc4046f295abf3b0bc Merge base: e5f9f00e9ffaca9656b05e6c390535d4820a0791 Reviewed: 2026-10-27 12:47:02 UTC Model: claude-opus-5-5 (effort high) Results: 4 reviewed of 4 in the report Verdicts: 2 improvement, 2 regression Tokens: 6931 input, 6156 cache read, 2052 cache write, 1608 output The verdicts are written by AI and can be wrong. ---- 1 / 4 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/f/furnace/furnace_0.6.8.3+git20250912+ds.orig.tar.xz Result: main furnace-0.6.8.3+git20250912+ds/extern/imgui_patched/backends/imgui_impl_win32.cpp:153:70: style: Parameter 'io' can be declared as reference to const [constParameterReference] Explanation: The function only reads the pointer value stored in `io.BackendPlatformUserData` and casts it to `ImGui_ImplWin32_Data*`. It returns that stored pointer, not a pointer or reference into `io` itself. With `const ImGuiIO& io`, the member has type `void* const`, and casting that value to `ImGui_ImplWin32_Data*` still compiles. So `io` can be const and the warning was a true positive. The new AST visitor also checks intermediate nodes such as the `.` member access. It treats the member access as a lifetime of `io` and wrongly concludes that the function returns a reference to `io`, which suppresses a correct warning. ---- 2 / 4 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/m/mygui/mygui_3.4.4+dfsg.orig.tar.xz Result: main MyGUI-mygui-84c2874/Demos/Demo_Colour/ColourPanel.cpp:305:45: style: Parameter '_colour' can be declared as reference to const [constParameterReference] Explanation: byIndex returns a non-const float& that refers to members of _colour (return _colour.red etc.). If _colour were made const, those returns would not compile as a float&, so the constParameterReference warning was a false positive. The PR now walks the '.' operator in the return expression and recognizes that the returned reference points into _colour, which removes the false positive. ---- 3 / 4 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/m/mygui/mygui_3.4.4+dfsg.orig.tar.xz Result: main MyGUI-mygui-84c2874/Tools/EditorFramework/ColourPanel.cpp:330:45: style: Parameter '_colour' can be declared as reference to const [constParameterReference] Explanation: byIndex returns a non-const float& that refers to members of _colour (e.g. `return _colour.red;`). If the parameter were declared const, these returns would not compile. The old code missed this because findReturns gives the '.' token, and for that token neither the varId check nor the lifetime check matched. The new AST visitor walks into the operand of '.', finds _colour, and suppresses the warning. Removing this false positive is correct. ---- 4 / 4 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/t/treesheets/treesheets_1.0.2.orig.tar.gz Result: main treesheets-1.0.2/lobster/src/lobster/typecheck.h:620:42: style: Parameter '_scopes' can be declared as reference to const [constParameterReference] Explanation: TopScope returns `_scopes.back().sf`, which is a copy of a `SubFunction*` value stored in a Scope. It is not a pointer to the vector or its elements. With `const vector&`, `back().sf` has type `SubFunction* const`, which still converts to `SubFunction*`. So the parameter can indeed be const, and the original warning was a true positive. The new AST walk follows the `?:` branches and the `.` member access. It then wrongly treats the returned member pointer as having its lifetime tied to `_scopes`, and suppresses a valid warning.