Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CWG2537 [dcl.fct] Overbroad grammar for parameter-declaration #7

Closed
jensmaurer opened this issue Feb 19, 2022 · 8 comments
Closed

CWG2537 [dcl.fct] Overbroad grammar for parameter-declaration #7

jensmaurer opened this issue Feb 19, 2022 · 8 comments

Comments

@jensmaurer
Copy link
Member

jensmaurer commented Feb 19, 2022

Full name of submitter (unless configured in github; will be published with the issue): Davis Herring

Reference (section label): dcl.fct 9.3.4.6

Link to reflector thread (if any): cplusplus/draft#4521

Issue description:

It should have a defining-type-specifier-seq instead of a decl-specifier-seq, since no other decl-specifier (a storage-class-specifier, a function-specifier, friend, typedef, constexpr, consteval, constinit, or inline) can be used there (unless we expect to get constexpr function parameters any day now!).

Suggested resolution:

@jensmaurer
Copy link
Member Author

CWG2537

@opensdh, please have a look.

@jensmaurer jensmaurer changed the title [dcl.fct] Overbroad grammar for parameter-declaration CWG2537 [dcl.fct] Overbroad grammar for parameter-declaration Feb 23, 2022
@opensdh
Copy link

opensdh commented Feb 24, 2022

[dcl.stc]/4, /5, [dcl.typedef]/1, and [dcl.inline]/4 can be simplified by removing references to function parameters.

@jensmaurer
Copy link
Member Author

Fixed. I also found one more.

@opensdh
Copy link

opensdh commented Feb 25, 2022

Don't keep me in such suspense—what's the one more?

@jensmaurer
Copy link
Member Author

@opensdh, just follow the link to CWG2537

@opensdh
Copy link

opensdh commented Feb 25, 2022

I did, but I see edits to only the four places I found.

@jensmaurer
Copy link
Member Author

jensmaurer commented Feb 25, 2022

Ah, sorry, I had overlooked the /5 in your list. So, nothing extra. Sorry for the noise.

@opensdh
Copy link

opensdh commented Feb 8, 2023

In review yesterday we realized that the even narrower type-specifier-seq would be sufficient, which could replace part of [dcl.fct]/17.

Several places do use decl-specifier-seq to refer to the appropriate part of any declaration, which would need updating here:

  • [basic.type.qualifier]/1
  • [dcl.pre]/3–4, which unfortunately describe just simple-declarations in a fashion that really means to pertain to all declarator-based declarations
  • [dcl.pre]/7, which has to choose between function/object declarations after parameter type adjustments
  • [dcl.spec.general]/3
  • [dcl.type.cv]/1, which already assumes that an init-declarator-list or member-declarator-list is available
  • [dcl.spec.auto.general]/2, which could just be changed to type-specifier-seq
  • [dcl.spec.auto.general]/5, which could use just type-specifier-seq for more cases
  • [dcl.meaning.general]/4–6
  • [temp.res.general]/4.3, whose parameter-relevant portions could be moved into /4.2

The sensible thing to do would presumably be to introduce a term (e.g., "the specifiers of a declaration are…") and use that everywhere. This is a larger change, of course, and might not be worth doing, although there the indicated places in the above list need work anyway.

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

No branches or pull requests

2 participants