This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 114a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-04-18


1693. Superfluous semicolons in class definitions

Section: 11.4  [class.mem]     Status: C++14     Submitter: Richard Smith     Date: 2013-05-29

[Moved to DR at the February, 2014 meeting.]

The grammar in 11.4 [class.mem] and 9.5.1 [dcl.fct.def.general] paragraph 1 are (in part):

This leads to the following curiosity:

  struct A {
    void f1() = delete;   // #1, ok
    void f2() = delete;;  // #2, ok
    void f3() = delete;;; // #3, error, extraneous semicolon
  };

This could be addressed by moving the semicolon into the productions for function-body for the non-default/delete forms or by adding empty-declaration to the list of member-declaration productions, as is done with namespace-scope declarations.

Proposed resolution (November, 2013):

  1. Change the grammar in 11.4 [class.mem] as follows:

  2. Change 11.4 [class.mem] paragraph 1 as follows:

  3. ...Except when used to declare friends (11.8.4 [class.friend]) or to introduce the name of a member of a base class into a derived class (9.9 [namespace.udecl]), or when the declaration is an empty-declaration, member-declarations declare members of the class, and each such member-declaration shall declare at least one member name of the class.