AI review of 2026-10-21_00-19-57-f64500ebe36f-results.txt PR: #8931 https://github.com/cppcheck-opensource/cppcheck/pull/8931 Tested: f64500ebe36fb5c0dcbe757b34b6a3532749642d Merge base: 37a06d244b5b55714ce97ba3293cec76185a7b86 Reviewed: 2026-10-27 12:50:29 UTC Model: claude-opus-5-5 (effort high) Results: 2 reviewed of 2 in the report Verdicts: 2 improvement Tokens: 2508 input, 4819 cache read, 4819 cache write, 370 output The verdicts are written by AI and can be wrong. ---- 1 / 2 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/c/cvs/cvs_1.12.13+real.orig.tar.gz Result: main cvs-1.12.13/zlib/contrib/iostream/zfstream.h:120:23: error: Returning object that will be invalid when returning. [returnDanglingLifetime] cvs-1.12.13/zlib/contrib/iostream/zfstream.h:120:24: note: Passed to constructor of 'gzomanip < int >'. cvs-1.12.13/zlib/contrib/iostream/zfstream.h:120:23: note: Returning object that will be invalid when returning. Explanation: The gzomanip constructor takes a function pointer `gzofstream &(*f)(gzofstream &, T)`. Before the PR, the `&` in the return type was wrongly treated as making `f` a reference. Cppcheck then thought gzomanip held a reference to a local and reported returnDanglingLifetime. In fact it stores a pointer to a free function (&setcompressionlevel) and an int copied by value, so nothing dangles. The PR fixes the reference flag for function pointers, which removes this false positive. ---- 2 / 2 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/c/cvs/cvs_1.12.13+real.orig.tar.gz Result: main cvs-1.12.13/zlib/contrib/iostream/zfstream.h:125:23: error: Returning object that will be invalid when returning. [returnDanglingLifetime] cvs-1.12.13/zlib/contrib/iostream/zfstream.h:125:24: note: Passed to constructor of 'gzomanip < int >'. cvs-1.12.13/zlib/contrib/iostream/zfstream.h:125:23: note: Returning object that will be invalid when returning. Explanation: The constructor parameter `gzofstream &(*f)(gzofstream &, T)` is a function pointer whose return type is a reference. It is not a reference itself. Main wrongly flagged `f` as a reference, so storing it looked like keeping a reference to a local. The returned gzomanip only holds a pointer to a free function and a copied int, so nothing dangles. The PR clears the reference flag for function-pointer declarators, which removes this false positive.