{ "tokens": { "input": 2508, "cache_read": 4819, "cache_write": 4819, "output": 370 }, "reviews": [ { "key": [ "https://ftp.debian.org/debian/pool/main/c/cvs/cvs_1.12.13+real.orig.tar.gz", "main cvs-1.12.13/zlib/contrib/iostream/zfstream.h:120:23: error: Returning object that will be invalid when returning. [returnDanglingLifetime]\n cvs-1.12.13/zlib/contrib/iostream/zfstream.h:120:24: note: Passed to constructor of 'gzomanip < int >'.\n cvs-1.12.13/zlib/contrib/iostream/zfstream.h:120:23: note: Returning object that will be invalid when returning." ], "verdict": { "verdict": "improvement", "confidence": "high", "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." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/cvs/cvs_1.12.13+real.orig.tar.gz", "main cvs-1.12.13/zlib/contrib/iostream/zfstream.h:125:23: error: Returning object that will be invalid when returning. [returnDanglingLifetime]\n cvs-1.12.13/zlib/contrib/iostream/zfstream.h:125:24: note: Passed to constructor of 'gzomanip < int >'.\n cvs-1.12.13/zlib/contrib/iostream/zfstream.h:125:23: note: Returning object that will be invalid when returning." ], "verdict": { "verdict": "improvement", "confidence": "high", "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." } } ], "started": "2026-10-21 03:56:37 UTC", "runner": "pc" }