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

A note in [namespace.udir] that metions "using-directive does no introduce name" should be turned to a normative rule #4764

Open
xmh0511 opened this issue Jul 20, 2021 · 8 comments

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Jul 20, 2021

[namespace.udir#3]

[Note 3: A using-directive does not introduce any names. — end note]

Whether a declaration introduces a name or not is significant in certain rules, for instance:
[module.interface#3]

An exported declaration that is not a module-import-declaration shall declare at least one name.

Since there is no other normative rule in the current standard that explicitly says a using-directive declaration does not introduce any name, hence, it's necessary to make the note be a normative rule.

@jensmaurer
Copy link
Member

There is nothing in the wording that say that a using-directive introduces any names, thus it doesn't introduce any.
(The note is just highlighting this fact; the note in the preceding paragraph points to the change in name lookup that is caused.)

@xmh0511
Copy link
Contributor Author

xmh0511 commented Jul 21, 2021

The "introduce name" is mentioned in another place, that is
[basic#pre-5]

Every name is introduced by a declaration, which is a

  • declaration, block-declaration, or member-declaration ([dcl.pre], [class.mem]),
  • [...]
  • using-declarator ([namespace.udecl]),

A using-directive is a declaration that is also a block-declaration. If there is no other place explicitly said such a declaration does not introduce a name, could we say it introduces the name due to [basic#pre-5.1]? Similar, in the section [namespace.udecl], it does not explicitly say that using-declaration introduces a name, however, it does introduce a name, and [basic#pre-5.7] also mention this point.

So, There is nothing in the wording that say that a using-directive introduces any names, thus it doesn't introduce any., which truly is it? In other words, there is nothing in the wording in [namespace.udecl] that says the using-declaration introduces a name, but it indeed does introduce a name. Hence, I think we should explicitly say that a using-directive does not introduce any name in order to exclude it from what says in [basic#pre-5]

@jensmaurer
Copy link
Member

What is the specification situation with static_assert? It never introduces a name and also is a member-declaration.

@xmh0511
Copy link
Contributor Author

xmh0511 commented Jul 21, 2021

static_assert is a more special case. I just think we should clarify this situation, either from [basic#pre-5] or explicitly say it in each relevant declaration's clause.

Since the note has existed in [namespace.udir#3], turn it to be a normative rule seems do not impact other things, and at least do it would make [namespace.udir] be clear about this point.

@jensmaurer
Copy link
Member

Well, saying something in one place and not saying the same thing in another place (e.g. for static_assert) is also confusing. "What's the difference between here and there that would warrant the difference in specification?"

@xmh0511
Copy link
Contributor Author

xmh0511 commented Jul 21, 2021

Agreed. [basic#pre-5] is not clear on specifying which concrete declarations that introduce names. It's better to specify them in the respective clause. BTW, "What's the difference between here and there that would warrant the difference in specification?" What does it mean?

@jensmaurer
Copy link
Member

If we say X in one place, but don't say X in another place (where it plausibly also applies), we leave confusion whether X does apply to that other place or not.

@xmh0511
Copy link
Contributor Author

xmh0511 commented Jul 21, 2021

Yes, it's exactly the status quo of expounding which declarations can introduce names.

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

2 participants