From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B7FAF3858C53; Wed, 4 May 2022 02:36:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B7FAF3858C53 From: "mh+gcc at glandium dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/104142] [9/10/11 Regression] Spurious warning unused-variable on const static variable and defaulted constructor Date: Wed, 04 May 2022 02:36:24 +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: 12.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: mh+gcc at glandium dot org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jason at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 May 2022 02:36:24 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104142 Mike Hommey changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mh+gcc at glandium dot org --- Comment #6 from Mike Hommey --- There's a different warning that interestingly only happens on 11.2 and 11.3 (not 11.1 or earlier versions), that is fixed by the patch in this bug: ``` struct Foo { explicit constexpr Foo(char) {} }; const Foo foo[] =3D {}; ``` ``` : In function 'void __static_initialization_and_destruction_0(int, int)': :5:11: error: statement has no effect [-Werror=3Dunused-value] 5 | const Foo foo[] =3D {}; | ^~~ ```=