-
Notifications
You must be signed in to change notification settings - Fork 774
[basic.pre,basic.link] Clarify 'declaration of entity' vs. namespace-alias #4833
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,9 +85,16 @@ | |
The interpretation of a \grammarterm{for-range-declaration} produces | ||
one or more of the above\iref{stmt.ranged}. | ||
\end{note} | ||
An entity $E$ is denoted by the name (if any) | ||
that is introduced by a declaration of $E$ or | ||
by a \grammarterm{typedef-name} introduced by a declaration specifying $E$. | ||
An entity $E$ is denoted by | ||
\begin{itemize} | ||
\item | ||
the name (if any) that is introduced by a declaration of $E$, or | ||
\item | ||
a \grammarterm{typedef-name} introduced by a declaration specifying $E$, or | ||
\item | ||
a \grammarterm{namespace-alias} introduced by | ||
a \grammarterm{namespace-alias-definition} denoting $E$. | ||
\end{itemize} | ||
|
||
\pnum | ||
A \defn{variable} is introduced by the | ||
|
@@ -2716,7 +2723,15 @@ | |
they both declare names with external linkage. | ||
\end{itemize} | ||
\begin{note} | ||
There are other circumstances in which declarations declare the same entity% | ||
An \grammarterm{alias-declaration}\iref{dcl.typedef}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not add this note instead to [basic.pre]/5 (changed above), perhaps phrased as
? I think namespace-alias-definition is then covered by implication. (The non-parallelism in that wording results from the lack of a pseudo-grammar term like using-name to distinguish identifiers with such a declaration, which I regard as no great omission.) If we prefer to leave it here, I think it goes better after the "other circumstances" note (which is more directly related to the paragraph). |
||
a \grammarterm{using-declarator}\iref{namespace.udecl}, or | ||
a \grammarterm{namespace-alias-definition}\iref{namespace.alias} | ||
does not declare any entities; | ||
a \grammarterm{typedef-name} or \grammarterm{namespace-alias} | ||
is not an entity\iref{basic.pre}. | ||
\end{note} | ||
\begin{note} | ||
There are other circumstances in which declarations declare the same entity | ||
\iref{dcl.link,temp.type,temp.spec.partial}. | ||
\end{note} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about
using type = struct A{};
? Moreover, sincealias-declaration
does not declare any entity why doesn't the declaration withtypedef
specifier do?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's true that an alias-declaration can contain a declaration of an entity, but I think it's clear here that it is the direct effect of the top-most declaration that is in question.
I'm not sure I understand the second question, although note that the paragraph begins by "enabling" names for linkage for purposes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
alias-declaration
anddeclaration specified with typedef
should have the same treatment since they are merely different ways to declare the identifier to be a typedef-name. In line 2690, we just sayalias-declaration
but do not mention the declaration with typedef specifier, it's the second question.