https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113760

Jakub Jelinek <jakub at gcc dot gnu.org> 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 <jakub at gcc dot gnu.org> ---
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.?
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?

Reply via email to