Skip to content
This repository has been archived by the owner on Sep 27, 2019. It is now read-only.

Problems with variadic parameters #107

Open
ericlippert opened this issue Sep 6, 2017 · 0 comments
Open

Problems with variadic parameters #107

ericlippert opened this issue Sep 6, 2017 · 0 comments

Comments

@ericlippert
Copy link
Contributor

There are numerous problems with variadic parameters.

In ordinary functions and methods, the grammar given is

  parameter-list:
    ...
    parameter-declaration-list  ,opt
    parameter-declaration-list  ,  ... 

But this isn't complete; the "..." is allowed to have an attribute, a type and a name, the same as any other parameter. The grammar should be

    variadic-parameter:
      ...
      attribute-specification-opt type-specifier ...  variable-name

Note that if it has a type then it must have a name, and if it has a name then it must have a type.

The grammar for constructor parameters is even more wrong:

  constructor-parameter-declaration-list:
    constructor-parameter-declaration
    constructor-parameter-declaration-list  ,  constructor-parameter-declaration

First of all, this does not allow a trailing comma when it should. Second, it makes no mention of variadic parameters, which are legal in a constructor.

Note that a variadic parameter with a name in a constructor is also allowed to have a visibility modifier, so that should be in the grammar as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant