https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114450
--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Jason Merrill <[email protected]>: https://gcc.gnu.org/g:04ec3d4712519e32f85c034ff4237fcd5f9fbe39 commit r16-7094-g04ec3d4712519e32f85c034ff4237fcd5f9fbe39 Author: Lucas Chollet <[email protected]> Date: Mon Jan 26 18:16:53 2026 +0800 c++: Fix false positive with -Wunused [PR114450] The patch fixes a bug in the detection of the usage of static variables inside generic lambdas. The comment in finish_id_expression_1 already mentions this case, but the code didn't actually handle it. PR c++/114450 gcc/cp/ChangeLog: * lambda.cc (generic_lambda_fn_p): Handle null argument. * semantics.cc (finish_id_expression_1): Check for generic lambda. gcc/testsuite/ChangeLog: * g++.dg/warn/Wunused-var-42.C: New test. Co-authored-by: Jason Merrill <[email protected]>
