Semicolons at the end of member function definitions

Volker Reichelt v.reichelt@netcologne.de
Mon Jul 30 23:36:00 GMT 2007


Hi,

I just stumbled over the patch

2007-03-26  Dirk Mueller  <dmueller@suse.de>

       * parser.c (cp_parser_member_declaration): Pedwarn
       about stray semicolons after member declarations.

which was approved by Gaby here:
http://gcc.gnu.org/ml/gcc-patches/2007-03/msg01456.html
and made it into the trunk here:
http://gcc.gnu.org/ml/gcc-cvs/2007-03/msg00841.html

It makes

  struct A
  {
     void foo() {};
  }

a hard error with -pedantic.

The 1998 version of the standard (sorry, I don't have the 2003 version
available) contains in [class.mem]:

  member-declaration:
    ...
    function-definition ;opt
    ...

Therefore, IMHO the patch is wrong and should be reverted.
Or am I missing something?

Regards,
Volker



More information about the Gcc mailing list