AI review of 2026-10-09_20-01-23-da724f2e5700-results.txt PR: #8931 https://github.com/cppcheck-opensource/cppcheck/pull/8931 Tested: da724f2e57007185f2db13d9252655017ada8eca Merge base: 79ac5ad488e59faa8ac7659946295d8118ffe2fa Reviewed: 2026-10-10 22:19:15 UTC Model: claude-opus-5-5 (effort high) Results: 7 reviewed of 7 in the report Verdicts: 7 improvement Tokens: 15694 input, 14472 cache read, 2412 cache write, 2845 output The verdicts are written by AI and can be wrong. ---- 1 / 7 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/s/storm-lang/storm-lang_0.8.1+dfsg.orig.tar.gz Result: main storm-lang-0.8.1+dfsg/Core/EngineFwd.cpp:63:10: error: Returning object that will be invalid when returning. [returnDanglingLifetime] storm-lang-0.8.1+dfsg/Core/EngineFwd.cpp:11:4: note: Passed to constructor of 'EngineFwdShared'. storm-lang-0.8.1+dfsg/Core/EngineFwd.cpp:63:10: note: Returning object that will be invalid when returning. Explanation: The function builds an `EngineFwdShared` table from function addresses such as `&runtime::threadGroup` and returns it. Its members are function pointers, and some of those functions return references (e.g. `Engine &(*)()`). Main wrongly treated members declared like `T& (*f)()` as references. That made it think the table was bound to temporaries, so it reported returnDanglingLifetime. A function address has static lifetime, so these warnings were false positives. The PR moves the `&` to the pointer's return type, which removes the false positive. ---- 2 / 7 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/s/storm-lang/storm-lang_0.8.1+dfsg.orig.tar.gz Result: main storm-lang-0.8.1+dfsg/Core/EngineFwd.cpp:63:10: error: Returning object that will be invalid when returning. [returnDanglingLifetime] storm-lang-0.8.1+dfsg/Core/EngineFwd.cpp:12:4: note: Passed to constructor of 'EngineFwdShared'. storm-lang-0.8.1+dfsg/Core/EngineFwd.cpp:63:10: note: Returning object that will be invalid when returning. Explanation: `fwd` is an EngineFwdShared aggregate initialized with addresses of functions (`&runtime::...`). Its members are function pointers, some of which return references (e.g. `Engine &(*f)()`). Main wrongly treated those members as reference members, so it reported that the returned object holds references to temporaries. Function addresses never dangle, so these warnings were false positives. The PR correctly attaches the `&` to the function pointer's return type, which removes them. ---- 3 / 7 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/s/storm-lang/storm-lang_0.8.1+dfsg.orig.tar.gz Result: main storm-lang-0.8.1+dfsg/Core/EngineFwd.cpp:63:10: error: Returning object that will be invalid when returning. [returnDanglingLifetime] storm-lang-0.8.1+dfsg/Core/EngineFwd.cpp:13:4: note: Passed to constructor of 'EngineFwdShared'. storm-lang-0.8.1+dfsg/Core/EngineFwd.cpp:63:10: note: Returning object that will be invalid when returning. Explanation: `fwd` is an aggregate of function pointers built from addresses like `&runtime::...`, and it is returned from the function. Some members of `EngineFwdShared` are probably function pointers that return references, e.g. `T &(*f)(...)`. Main wrongly treated those members as reference members. So it thought addresses of functions were bound to references that would dangle, and reported `returnDanglingLifetime`. Function addresses never dangle, so this was a false positive. The PR correctly marks such members as pointers rather than references, which removes the bogus warning. ---- 4 / 7 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/s/storm-lang/storm-lang_0.8.1+dfsg.orig.tar.gz Result: main storm-lang-0.8.1+dfsg/Core/EngineFwd.cpp:63:10: error: Returning object that will be invalid when returning. [returnDanglingLifetime] storm-lang-0.8.1+dfsg/Core/EngineFwd.cpp:24:4: note: Passed to constructor of 'EngineFwdShared'. storm-lang-0.8.1+dfsg/Core/EngineFwd.cpp:63:10: note: Returning object that will be invalid when returning. Explanation: `fwd` is an `EngineFwdShared` aggregate initialized with function addresses such as `&runtime::allocEngine`. The members are function pointers. Those at the reported lines most likely have a reference return type (e.g. `Engine &(*allocEngine)(...)`). Main wrongly treated these members as references, so it concluded that a reference to the temporary `&runtime::allocEngine` was stored and returned, which is a false dangling-lifetime error. The PR makes a `&` before `(*f)()` belong to the return type rather than the variable. The member is then correctly seen as a plain pointer, and the false positive disappears. ---- 5 / 7 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/s/storm-lang/storm-lang_0.8.1+dfsg.orig.tar.gz Result: main storm-lang-0.8.1+dfsg/Core/EngineFwd.cpp:63:10: error: Returning object that will be invalid when returning. [returnDanglingLifetime] storm-lang-0.8.1+dfsg/Core/EngineFwd.cpp:40:4: note: Passed to constructor of 'EngineFwdShared'. storm-lang-0.8.1+dfsg/Core/EngineFwd.cpp:63:10: note: Returning object that will be invalid when returning. Explanation: `fwd` is a struct of function pointers filled with addresses of functions such as `&runtime::threadGroup`, and it is returned (very likely as a static object). The member for line 40 is presumably a function pointer whose return type is a reference, e.g. `ThreadGroup &(*threadGroup)(...)`. Main wrongly treated that member as a reference variable. It then thought the member bound to a temporary and reported a dangling lifetime. Storing a function address in a function pointer cannot dangle. The PR fixes the reference flag for such declarators, so removing this false positive is correct. ---- 6 / 7 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/s/storm-lang/storm-lang_0.8.1+dfsg.orig.tar.gz Result: main storm-lang-0.8.1+dfsg/Core/EngineFwd.cpp:63:10: error: Returning object that will be invalid when returning. [returnDanglingLifetime] storm-lang-0.8.1+dfsg/Core/EngineFwd.cpp:41:4: note: Passed to constructor of 'EngineFwdShared'. storm-lang-0.8.1+dfsg/Core/EngineFwd.cpp:63:10: note: Returning object that will be invalid when returning. Explanation: `fwd` is an aggregate-initialized `EngineFwdShared` whose members are function pointers such as `&runtime::threadLock`. Some of these pointers have types like `T& (*threadLock)(...)`. Before the PR, Cppcheck took the `&` of the return type as making the member itself a reference. It then treated the address of a function bound to that member as a dangling lifetime when `fwd` is returned. A function address cannot dangle, so the warning was a false positive. The PR correctly assigns the `&` to the function pointer's return type, which removes the false positive. ---- 7 / 7 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/s/storm-lang/storm-lang_0.8.1+dfsg.orig.tar.gz Result: main storm-lang-0.8.1+dfsg/Core/EngineFwd.cpp:63:10: error: Returning object that will be invalid when returning. [returnDanglingLifetime] storm-lang-0.8.1+dfsg/Core/EngineFwd.cpp:56:4: note: Passed to constructor of 'EngineFwdShared'. storm-lang-0.8.1+dfsg/Core/EngineFwd.cpp:63:10: note: Returning object that will be invalid when returning. Explanation: The function fills an `EngineFwdShared` struct with addresses of functions (here `&::stackInfo`) and returns it. The struct members are function pointers, and some of those functions return references, e.g. `StackInfoSet &(*stackInfo)()`. Main wrongly treated these members as references because of the `&` before the parentheses. It then reported that the returned object holds the lifetime of a local. A function address cannot dangle, so the warning was a false positive. The PR now assigns that `&` to the return type of the function pointer, which removes it.