[dcl.pre] What's the meaning of (re)introducing names into the program?
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 221
- Forks
- 813
- Avg merge
- 16h 4m
- Merged PRs (30d)
- 36
Description
In a simple-declaration, the optional init-declarator-list can be omitted only when declaring a class ([class.pre]) or enumeration ([dcl.enum]), that is, when the decl-specifier-seq contains either a class-specifier, an elaborated-type-specifier with a class-key ([class.name]), or an enum-specifier. In these cases and whenever a class-specifier or enum-specifier is present in the decl-specifier-seq, the identifiers in these specifiers are also declared (as class-names, enum-names, or enumerators, depending on the syntax). In such cases, the decl-specifier-seq shall (re)introduce one or more names into the program.
Please see this example
struct {
int c;
};
Isn't that the member-declarator in the anonymous class does introduce the name c?
Every name is introduced by a declaration, which is a
- member-declarator ([class.mem]),
But the example is rejected by major implementations other than MSVC, I suppose the result is impacted by the above rule. The meaning of (re)introducing names into the program is arguably unclear. What can be sure is that the decl-specifier-seq struct { int c;} does introduce a name c, but whether introduce the name into program is not sure.
Maybe we should state when the names are considered to be (re)introduced into the program. After all, there is no normative rule related to this concept.
Maybe it could be reworded to be that
In such cases, the decl-specifier-seq shall (re)introduce one or more names that shall be bound to the scope where the declaration inhabits.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the quoted [dcl.pre] wording and the anonymous-class example, then read the referenced [class.pre], [dcl.enum], and [class.mem] rules. The issue is resolved when the standard clearly defines what it means for names to be (re)introduced into the program and unambiguously determines whether the example is valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100