[Bug c++/96068] Extra semicolon outside of a function should be allowed after c++11?
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96068 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #7 from Jakub Jelinek --- I wonder if we shouldn't have a style warning for this though, if the empty statement's ; is immediately after } in the source, tell user it is unnecessary, while not warning if there is some comment or newline or whitespace etc. in between. Ran into this while backporting PR105256 to gcc-10 branch which doesn't have this fix and the testcase contains such a useless semicolon: void S::Prefs::Load() { *this = {}; };
[Bug c++/96068] Extra semicolon outside of a function should be allowed after c++11?
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96068 Andrew Pinski changed: What|Removed |Added CC||anders.granlund.0 at gmail dot com --- Comment #6 from Andrew Pinski --- *** Bug 67013 has been marked as a duplicate of this bug. ***
[Bug c++/96068] Extra semicolon outside of a function should be allowed after c++11?
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96068 Andrew Pinski changed: What|Removed |Added CC||mail at milianw dot de --- Comment #5 from Andrew Pinski --- *** Bug 103131 has been marked as a duplicate of this bug. ***
[Bug c++/96068] Extra semicolon outside of a function should be allowed after c++11?
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96068 Jonathan Wakely changed: What|Removed |Added Status|ASSIGNED|RESOLVED Target Milestone|--- |11.0 Resolution|--- |FIXED --- Comment #4 from Jonathan Wakely --- Fixed on trunk
[Bug c++/96068] Extra semicolon outside of a function should be allowed after c++11?
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96068 --- Comment #3 from CVS Commits --- The master branch has been updated by Jonathan Wakely : https://gcc.gnu.org/g:92414bb6b077642eefc24080637b6bc766499391 commit r11-1852-g92414bb6b077642eefc24080637b6bc766499391 Author: Jonathan Wakely Date: Mon Jul 6 15:58:33 2020 +0100 c++: Allow empty-declaration in C++11 and later (PR 96068) Since C++11 a semim-colon on its own at namespace scope is not invalid, so do not give a pedantic diagnostic about it. gcc/cp/ChangeLog: PR c++/96068 * parser.c (cp_parser_toplevel_declaration): Only do pedwarn for empty-declaration in C++98. gcc/testsuite/ChangeLog: * g++.old-deja/g++.bugs/900404_04.C: Add c++98_only selector to dg-error for extra ';'. * g++.old-deja/g++.law/missed-error2.C: Likewise.
[Bug c++/96068] Extra semicolon outside of a function should be allowed after c++11?
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96068 Jonathan Wakely changed: What|Removed |Added Status|NEW |ASSIGNED Keywords||patch Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org --- Comment #2 from Jonathan Wakely --- Patch submitted: https://gcc.gnu.org/pipermail/gcc-patches/2020-July/549453.html
[Bug c++/96068] Extra semicolon outside of a function should be allowed after c++11?
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96068 Jonathan Wakely changed: What|Removed |Added Last reconfirmed||2020-07-06 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Keywords|diagnostic | --- Comment #1 from Jonathan Wakely --- --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -13502,10 +13502,11 @@ cp_parser_toplevel_declaration (cp_parser* parser) cp_parser_pragma (parser, pragma_external, NULL); else if (token->type == CPP_SEMICOLON) { - /* A declaration consisting of a single semicolon is -invalid. Allow it unless we're being pedantic. */ cp_lexer_consume_token (parser->lexer); - pedwarn (input_location, OPT_Wpedantic, "extra %<;%>"); + /* 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 %<;%>"); } else /* Parse the declaration itself. */