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

[basic.scope.temp] p2 Clarify the scope where D should have inhabited #5471

Open
xmh0511 opened this issue May 17, 2022 · 0 comments
Open

[basic.scope.temp] p2 Clarify the scope where D should have inhabited #5471

xmh0511 opened this issue May 17, 2022 · 0 comments

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented May 17, 2022

[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 P 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 the scope P instead inhabits the same scope as that D would inhabit if the scope P were ignored.

Or, we can just say

Each template-declaration D introduces a template parameter scope P that extends from the beginning of its template-parameter-list to the end of the template-declaration. D inhabits the scope S after ignoring P. Any declaration outside the template-parameter-list that would inhabit the scope P instead inhabits S.

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

1 participant