Title
Overbroad grammar for parameter-declaration
Status
drafting
Section
9.3.4.6 [dcl.fct]
Submitter
Davis Herring

Created on 2021-02-25.00:00:00 last changed 22 months ago

Messages

Date: 2023-02-10.14:41:48

CWG 2023-02-07

Additional drafting is needed to address references to decl-specifier-seq in other parts of the standard. A list is here. Furthermore, reducing the grammar to a type-specifier-seq appears to be sufficient.

Date: 2022-11-15.00:00:00

Proposed resolution (November, 2022):

  1. Change in 9.2.2 [dcl.stc] paragraph 4 as follows:

    There can be no static function declarations within a block, nor any static function parameters.
  2. Change in 9.2.2 [dcl.stc] paragraph 5 as follows:

    The extern specifier shall not be used in the declaration of a class member or function parameter.
  3. Change in 9.2.4 [dcl.typedef] paragraph 1 as follows:

    The typedef specifier shall not be combined in a decl-specifier-seq with any other kind of specifier except a defining-type-specifier, and it shall not be used in the decl-specifier-seq of a parameter-declaration (9.3.4.6 [dcl.fct]) nor in the decl-specifier-seq of a function-definition (9.5 [dcl.fct.def]).
  4. Change in 9.2.8 [dcl.inline] paragraph 4 as follows:

    The inline specifier shall not appear on a block scope declaration or on the declaration of a function parameter.
  5. Change in 9.3.4.6 [dcl.fct] paragraph 3 as follows:

      parameter-declaration:
          attribute-specifier-seqopt thisopt decl-specifier-seq defining-type-specifier-seq declarator
          attribute-specifier-seqopt thisopt decl-specifier-seq defining-type-specifier-seq declarator = initializer-clause
          attribute-specifier-seqopt thisopt decl-specifier-seq defining-type-specifier-seq abstract-declaratoropt
          attribute-specifier-seqopt thisopt decl-specifier-seq defining-type-specifier-seq abstract-declaratoropt = initializer-clause
    
Date: 2021-02-25.00:00:00

9.3.4.6 [dcl.fct] paragraph 3 specifies the grammar for parameter-declaration:

  parameter-declaration:
      attribute-specifier-seqopt thisopt decl-specifier-seq declarator
      attribute-specifier-seqopt thisopt decl-specifier-seq declarator = initializer-clause
      attribute-specifier-seqopt thisopt decl-specifier-seq abstract-declaratoropt
      attribute-specifier-seqopt thisopt decl-specifier-seq abstract-declaratoropt = initializer-clause

This is overly permissive; using a defining-type-specifier-seq instead of a decl-specifier-seq is sufficient.

History
Date User Action Args
2023-02-10 14:41:48adminsetmessages: + msg7189
2023-02-06 20:47:07adminsetstatus: tentatively ready -> drafting
2022-11-20 07:54:16adminsetstatus: open -> tentatively ready
2022-02-18 07:47:23adminsetmessages: + msg6742
2021-02-25 00:00:00admincreate