A definition for a class introduces a class scope rather than doing that by a declaration that is not a definition
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 221
- Forks
- 813
- Avg merge
- 16h 4m
- Merged PRs (30d)
- 36
Description
[basic.scope.class#1]
Any declaration of a class or class template C introduces a class scope that includes the member-specification of the class-specifier for C (if any). For each non-friend redeclaration or specialization whose target scope is or is contained by the scope, the portion after the declarator-id, class-head-name, or enum-head-name is also included in the scope.
The declaration of a class or class template does not definitely specify that the declaration must be the definition, which could be inferred from [dcl.dcl#dcl.pre-5]
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.
That hints struct C; is also a declaration of class C, however, the declaration does not introduce a class scope. I think we should reduce the extent of "declaration" to use "definition", which means only a class-specifier can introduce the class scope.
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 [basic.scope.class#1] and compare its use of "declaration" with [dcl.dcl#dcl.pre-5] and the class declaration rules. Check how a forward declaration such as struct C; differs from a class definition, then update the wording so only the intended declaration introduces a class scope. Done means the clauses are consistent and no longer imply that a forward declaration creates one.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100