[basic.scope.temp] p2 Clarify the scope where D should have inhabited
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 221
- Forks
- 813
- Avg merge
- 16h 4m
- Merged PRs (30d)
- 36
Description
[basic.scope.temp] p2 says
Each template-declaration D introduces a template parameter scope that extends from the beginning of its template-parameter-list to the end of the template-declaration. Any declaration outside the template-parameter-list that would inhabit that scope instead inhabits the same scope as D.
Since we have said that the template-declaration D introduced a template scope that is extended to the end of D before we state the second sentence. According to [basic.scope.scope] p2
A declaration inhabits the immediate scope at its locus
Consider this example
template<class T>
struct X{};
The locus of the class-specifier is immediately after X, that is, the locus of the class specifier is contained by the template parameter scope. This makes what scope D inhabits ambiguous. The intent is to say that D inhabits the global scope. The improvement might be:
Each template-declaration D introduces a template parameter scope
Pthat extends from the beginning of its template-parameter-list to the end of the template-declaration. Any declaration outside the template-parameter-list that would inhabit the scopePinstead inhabits the same scope as that D would inhabit if the scopePwere ignored.
Or, we can just say
Each template-declaration D introduces a template parameter scope
Pthat extends from the beginning of its template-parameter-list to the end of the template-declaration.Dinhabits the scopeSafter ignoringP. Any declaration outside the template-parameter-list that would inhabit the scopePinstead inhabitsS.
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.temp] p2 and compare its wording with [basic.scope.scope] p2, using the template struct X{} example as the test case. Done means the rule unambiguously places D and declarations outside the template-parameter-list in the intended scope, without changing the stated template parameter scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers, documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100