From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 764143858C53; Wed, 7 Feb 2024 09:29:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 764143858C53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707298198; bh=kiAW5F7oODMDD6O4YEka/cXEwfvRfEK7e1JSPOpiR9A=; h=From:To:Subject:Date:In-Reply-To:References:From; b=o9sB/aioypy+zmyFEQPBhaShYe5HKsQfcbiOnMCg7JwhfmBhgJsT3j3Cg/1mEB3lK gvQbYaxKyYi3T6Wq8Mut/nSmmhXjhpm6XfrZXQUgZVVNF/KjtFWIR6Aq7oPkZCdc/y l85b6BTufJSFyjPFhcSpOqJbUYpy/7PVqezqlx6g= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/113760] [DR1693] gcc rejects valid empty-declaration in pedantic mode Date: Wed, 07 Feb 2024 09:29:57 +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: unknown X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub 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: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113760 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |jason at gcc dot gnu.org, | |mpolacek at gcc dot gnu.org --- Comment #7 from Jakub Jelinek --- g++ emits 4 errors on struct S { void foo () {} void bar () {}; void baz () =3D delete; void qux () =3D delete; ; void corge () =3D delete; ; ; int s; ; }; ; ; (one after qux, 2 after corge, one after s), clang++ -pedantic-errors -std=3Dc++23 including trunk 2 (one after corge, one after s), so neither implements the DR. Strangely, with -pedantic-errors -std=3Dc++23 -Wextra-s= emi it warns 7 times but doesn't error (which is I think the desirable state). Now, g++ with -pedantic-errors -std=3Dc++23 -Wextra-semi emits just one war= ning on the ; after bar and still the 4 errors. That said, -Wextra-semi in GCC is documented that way: Warn about redundant semicolons after in-class function definitions. and clang doesn't bother to document it at all (at least haven't found it). So, shall we change documentation of -Wextra-semi and say change /* A declaration consisting of a single semicolon is invalid * before C++11. Allow it unless we're being pedantic. */ if (cxx_dialect < cxx11) pedwarn (input_location, OPT_Wpedantic, "extra %<;%>"); to else warning (OPT_Wextra_semi, "extra %<;%>"); etc.? Then there is if (!in_system_header_at (token->location)) { gcc_rich_location richloc (token->location); richloc.add_fixit_remove (); pedwarn (&richloc, OPT_Wpedantic, "extra %<;%>"); } should that be similarly if (cxx_dialect < cxx11) pedwarn; else warning ? Or, if we want to change this already for GCC 14, do that if (cxx_dialect < cxx11) part just before the last pedwarn above and add the else warning for GCC 15?=