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

CWG3005 [basic.scope.scope] Function parameters can be name-independent #681

Open
Eisenwave opened this issue Mar 10, 2025 · 2 comments
Open

Comments

@Eisenwave
Copy link
Collaborator

Eisenwave commented Mar 10, 2025

Reference (section label): [basic.scope.scope] pargraph 5, bullet 1

Link to reflector thread (if any):

Issue description

From P2169R4:

In Varna, EWG decided not to support function parameter names and requires clauses parameter as these can remained unamed without semantics differences.

See also poll: cplusplus/papers#878 (comment)

This design was not worded correctly because [basic.scope.scope] paragraph 5, bullet 1 permits all variables with automatic storage duration named _ to be name-independent, including function parameters.

Suggested resolution

Change [basic.scope.scope] paragraph 5 as follows:

A declaration is name-independent if its name is _ (U+005F LOW LINE) and it declares

  • a variable with automatic storage duration other than a function parameter,
  • a structured binding with no storage-class-specifier and not inhabiting a namespace scope,
  • the variable introduced by an init-capture, or
  • a non-static data member of other than an anonymous union.

Recommended practice: Implementations should not emit a warning that a name-independent declaration is used or unused.

@Eisenwave
Copy link
Collaborator Author

Note that cplusplus/draft#7728 also changes the same paragraph; maybe we can do that editorial change as a drive-by in here.

@jensmaurer
Copy link
Member

CWG3005

@jensmaurer jensmaurer changed the title [basic.scope.scope] Function parameters can be name-independent CWG3005 [basic.scope.scope] Function parameters can be name-independent Mar 11, 2025
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