-
Notifications
You must be signed in to change notification settings - Fork 771
[namespace.def.general] p6 Clarify "enclosing" and inserted using-directive #4556
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
Comments
The paragraph you quoted seems redundant with normative statement elsewhere.
As a stretch, this could be interpreted to apply to "enclosing" as well. Regarding your second issue (about the implicit using-directive), I think this shouldn't have survivied P1787. @opensdh, are you ok with removing "a using-directive ([namespace.udir]) that names the inline namespace is implicitly inserted into the enclosing namespace"? |
I would argue here, [dcl.pre p2] presumably applies to the following example void fun(int(*ptr)()); For the sentence: the declarator-id in the function declaration is... Here the declarator-id should be I think |
For the first sentence, I'd like to point out that it is vague anyway ("in most respects"). And I think we can fix the sentence by saying " of the innermost enclosing namespace". |
Maybe, of the innermost enclosing non-inline namespace and these intervening enclosing inline namespaces would be more clear. namespace G{
namespace A{ // innermost enclosing non-inline namespace
inline namespace B{ // intervening inline namespace
inline namespace C{
int v;
}
}
}
}
G::A::v = 0; // well-formed
G::A::B::v = 0; // well-formed
G::v = 0; // ill-formed |
The following p7 exactly says that it's transitive, so I don't think we need to say anything special for the multiple-nested-inline namespace case in p6. |
Well, but the innermost enclosing non-inline namespace is necessary. Like the above example, B is enclosing the namespace of |
Not needed. The innermost enclosing namespace of C is B. Everything that follows is valid and good for B (after all, you can explicitly refer to inline namespaces). But because B is also inline, the rule applies transitively, where A is the enclosing namespace for B. And since you can name C::v as B::v, you can thus also name it as A::v (but not as G::v). |
Ah, it together with p7 states that meaning. That's concise here. 👍 |
@jensmaurer It seems that [namespace.def#general-6] still exists a similar issue.
Which "enclosing namespace" does the emphasized wording refer to? Is it the innermost enclosing namespace or something else? According to the subject in this issue, since these properties are transitive, I think "the enclosing namespace" should refer to "the innermost enclosing namespace". |
The first place that needs to be precise is
Since the following vague(misleading) sentence has been removed in the current draft
Presumably, the wording
enclosing
should assume to have the meaning in English, that is, all namespaces that declared in a namespace A, we would say A enclosing those namespaces.For the first bullet, Should it be precise to
it together with the following rule
clarify this case
The second issue is
#1
Is it a bit misleading and useless? According to the statement for lookup rule in the current draft, such a using-directive does not affect the result of the lookup, since the following rule
Even though in the current standard, the relevant rule does also clearly state this point
And there's a more readable rule in [basic.lookup.argdep] that can instead of the initial sentence of the above rule at #1.
So, Is it necessary to remove the redundant and a bit misleading rule to follow the current draft?
The text was updated successfully, but these errors were encountered: