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.scope] The meaning of "denote different entities" is vague #4787
Comments
Yes, they declare the same entity. They are invalid because [basic.link]/11:
|
IMO, although they violate [basic.link]/11, but it doesn't mean violate [basic.link]/11 can be considered they don't denote the same entity, right? This issue tries to claim the exact meaning of "denote different entities". Two different kinds of entities categorized by [basic#pre-3] should be different entities even if they satisfy [basic.link#8]. Conflating [basic.link#8] and [basic.link]/11 to clarify which two declarations declare the same entity is what I'm intending to propose.
|
Right. They do declare the same entity. And [basic.link]/11 makes it clear that an entity cannot be redeclared to have a different category, otherwise it's an error. |
Well, consider this example namespace A {}
namespace B = A; //#1
namespace B {} //#2
|
Regarding the namespace example: [basic.link] p8 is not applicable, because #1 does not declare an entity at all (a namespace-alias is not an entity; similar to the fact that a typedef-name is not entity). Thus, [basic.scope.scope] p4 kicks in, because the two declarations denote different entities (#1 denotes the entity "namespace A", but #2 denotes the entity "namespace B"). |
Since that's the case, I think we should still improve [basic.scope.scope] p4, change it to
Specifically, [basic.pre] refers [basic.pre] p5
Although, [basic.pre] p5 seems to have omitted a case that is namespace-alias, IMO, [basic.pre] p5 should be that
The modification to [basic.scope.scope] p4 make the meaning more clear, the rule requires whether the name introduced by the declarations denote different entities or not; Instead, not merely whether two declarations declare the same entity. The link [basic.link] could result in that misleading. The latter case still can be determined as per [basic.link] if two declarations do declare entities. In addition, we should phrase the similar wording for [namespace.alias] as did in [dcl.typedef] Add a rule in [namespace.alias] p2
It stresses that namespace-alias-definition is a declaration that does not introduce an entity. @jensmaurer Please have a look. |
I'm sympathetic to augmenting [basic.pre] p5 to mention the namespace alias, and I think a clarifying note in [basic.link] p8 that some declarations don't declare entities might be helpful to highlight "declarations of entities". |
Since [basic.link] follows "different entities", it hints that the meaning of "different entities" is given in [basic.link#8]. Consider this example
According to [basic.scope.scope#3], such two declarations correspond, and according to [basic.link#8], they declare the same entity. According to [basic#pre-5]
Since these two declarations declare the same entity, does it mean the names
fun
in the two declarations denote the same entity? However, according to [basic#pre-3]How can a function and a variable be the same entity? It seems result in this issue. That is, what's the exact meaning of "denote different entities"? Merely determined by [basic.link#8] or should base it on by adding some other restrictions?
The text was updated successfully, but these errors were encountered: