From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 985AC3856957; Fri, 23 Sep 2022 16:22:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 985AC3856957 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663950177; bh=PLFmNhBMtayqaHD98VMRyNvAGD3BNw93qjEIOQmQRAE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JMr827x7SdiZ3ZVjLU27Fg7EofWxNq2lEIxxPlMfVnwbMQ1Gj1tGmeB8NhkoScJYA xNMuH0G6vBS5Ki7kpFMlGpQa5s6+1lph6QjEnvDWPEMptwV9l326QdTGZPg9m4TP/k ETPWO63JTIwskirlKGSU/c95o2jcaohhC0yOToJk= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/88804] incorrect unused but set static variable in templated lambda Date: Fri, 23 Sep 2022 16:22:28 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 8.2.1 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: short_desc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D88804 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Inconsistently diagnosed |incorrect unused but set |unused but set static |static variable in |variable in lambda |templated lambda --- Comment #4 from Andrew Pinski --- Another example where the warning happens but should not: void foo(int); template void call(T t) { t(0); } void bar() { static int x=3D3; call([](t){ foo(x); }); } Basically the templated lambda is causing the static variable not be marked= ...=