public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/113760] [DR1693] gcc rejects valid empty-declaration in pedantic mode Date: Mon, 12 Feb 2024 16:38:43 +0000 [thread overview] Message-ID: <bug-113760-4-zoahcPC7cJ@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-113760-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113760 --- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #7) > g++ emits 4 errors on > struct S > { > void foo () {} > void bar () {}; > void baz () = delete; > void qux () = delete; > ; > void corge () = delete; > ; > ; > int s; > ; > }; > ; > ; > (one after qux, 2 after corge, one after s), clang++ -pedantic-errors > -std=c++23 including trunk 2 (one after corge, one after s), so neither > implements the DR. Strangely, with -pedantic-errors -std=c++23 -Wextra-semi > it warns 7 times but doesn't error (which is I think the desirable state). > Now, g++ with -pedantic-errors -std=c++23 -Wextra-semi emits just one > warning 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.? Yeah, I'd say so. > 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 ? I think so. The < cxx11 is definitely missing here. > 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? I would do it all at once. I guess: {} -> no warnings in any dialect -pedantic -> pedwarns only in C++03 -Wextra-semi -> all warnings in all dialects -std=c++11 -pedantic -Wextra-semi -> only -Wextra-semi warnings -std=c++03 -pedantic -Wextra-semi -> pedwarns -std=c++11 -pedantic -Wno-extra-semi -> no warnings -std=c++03 -pedantic -Wno-extra-semi -> no warnings -std=c++03 -pedantic-errors -Wextra-semi -> errors (?) -std=c++11 -pedantic-errors -Wextra-semi -> warnings
next prev parent reply other threads:[~2024-02-12 16:38 UTC|newest] Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-02-05 7:07 [Bug c++/113760] New: " tanksherman27 at gmail dot com 2024-02-05 7:14 ` [Bug c++/113760] " pinskia at gcc dot gnu.org 2024-02-05 7:19 ` pinskia at gcc dot gnu.org 2024-02-05 7:23 ` pinskia at gcc dot gnu.org 2024-02-05 10:13 ` redi at gcc dot gnu.org 2024-02-05 14:49 ` kab at acm dot org 2024-02-05 15:10 ` [Bug c++/113760] [DR1693] " redi at gcc dot gnu.org 2024-02-07 9:29 ` jakub at gcc dot gnu.org 2024-02-12 16:38 ` mpolacek at gcc dot gnu.org [this message] 2024-02-12 16:46 ` mpolacek at gcc dot gnu.org 2024-02-12 17:07 ` mpolacek at gcc dot gnu.org 2024-02-12 21:29 ` mpolacek at gcc dot gnu.org 2024-02-12 23:36 ` harald at gigawatt dot nl 2024-02-12 23:49 ` mpolacek at gcc dot gnu.org 2024-02-13 1:17 ` harald at gigawatt dot nl 2024-02-13 1:54 ` mpolacek at gcc dot gnu.org 2024-02-13 19:27 ` mpolacek at gcc dot gnu.org 2024-02-13 23:08 ` cvs-commit at gcc dot gnu.org 2024-02-13 23:09 ` mpolacek at gcc dot gnu.org 2024-05-15 17:26 ` cvs-commit at gcc dot gnu.org 2024-05-15 17:26 ` mpolacek at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-113760-4-zoahcPC7cJ@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).