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
[dcl.constinit] p1 "Declaration of a variable" is broken wording #6523
Comments
Actually this wording issue extends beyond that; there are 11 uses of "declaration of a variable" in the standard right now. |
I think this is wrong. |
Honestly that might make the wording issue even more severe, because it's unclear what a variable even is. In the declaration The variable isn't the thing which is declared (the object or reference is) for sure, so declaration of a variable is meaningless wording. When we say that "
|
I'm not suggesting a change here. |
We have a long-standing problem with the wording around "variable" that some variables can denote different objects at different times. For example, `thread_local int x;" denotes a different object in each thread. I don't think the cosmetic adjustment from "declaration of a variable" to "variable declaration" is worth the bother, but anyone tackling the full problem (see above) is most welcome to do so; probably that should be in the form of a paper. |
Please bear with me, but I can't help but think that "variable" is missing from the list of things that are entities. Entities are said to be "introduced" by declarations. And so are variables. And things far away from [basic] treat variables as if they were entities. For example https://eel.is/c++draft/expr.prim.id#unqual-3
Even the text directly surrounding the definition of "entity" and "variable" is difficult to parse without "variable" being an entity itself. It was there in the list in the past, but why was it removed? |
I remember filing an NB comment or Core issue on this around C++11 FDIS time. The omission of |
- [dcl.constinit] p1
This is broken wording because [basic.pre] says:
What the former paragraph says is thus:
Inlining the definition gives us "declaration of a declaration" which is either meaningless or recursive.
Suggested Fix
Extend [basic.pre] p6 as follows:
A *variable* is introduced by the declaration of a reference other than a non-static data member or of an object. The variable's name, if any, denotes the reference or object. +Such a declaration is called *variable declaration*.
Then, in the entire document:
The text was updated successfully, but these errors were encountered: