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

Created on 2021-02-25.00:00:00 last changed 2 weeks ago

Messages

Date: 2022-11-20.07:54:16

Proposed resolution (approved by CWG 2022-11-11):

  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
2022-11-20 07:54:16adminsetstatus: open -> tentatively ready
2022-02-18 07:47:23adminsetmessages: + msg6742
2021-02-25 00:00:00admincreate