You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[basic.lookup.unqual]/4-6 don't quite use formal terminology for certain things.
A name used in global scope, outside of any function, class or user-declared namespace, shall be declared before its use in global scope.
This defines the concept of "global scope". But where does the line get drawn for being "outside" of a function? Is the "inside" of the function the body of the function definition, or something else? Are the parameters or return values of a function declaration/definition considered "inside" or "outside"? The obvious intent is to talk about the function body (that names in a function body are not in the global scope), but it's not 100% clear.
Similar questions could be asked of class and namespaces.
Paragraph 5 has a different problem:
A name used in a user-declared namespace outside of the definition of any function or class shall be declared before its use in that namespace or before its use in a namespace enclosing its namespace.
Unlike "outside of a function", a function definition is a well-defined construct. However, a function definition includes its prototype: return value and parameters. Again, this is likely intended to mean the body of a function definition.
In paragraph 6, we have:
In the definition of a function that is a member of namespace N, a name used after the function's declarator-id shall be declared before its use in the block in which it is used or in one of its enclosing blocks ([stmt.block]) or shall be declared before its use in namespace N or, if N is a nested namespace, shall be declared before its use in one of N's enclosing namespaces.
The issue here is that return types can appear before the declarator-id, so that needs to be accounted for here.
The text was updated successfully, but these errors were encountered:
The name lookup section has numerous issues, which are addressed by the wholesale rewrite in P1787 Declarations and where to find them cplusplus/papers#533.
[basic.lookup.unqual]/4-6 don't quite use formal terminology for certain things.
This defines the concept of "global scope". But where does the line get drawn for being "outside" of a function? Is the "inside" of the function the body of the function definition, or something else? Are the parameters or return values of a function declaration/definition considered "inside" or "outside"? The obvious intent is to talk about the function body (that names in a function body are not in the global scope), but it's not 100% clear.
Similar questions could be asked of class and namespaces.
Paragraph 5 has a different problem:
Unlike "outside of a function", a function definition is a well-defined construct. However, a function definition includes its prototype: return value and parameters. Again, this is likely intended to mean the body of a function definition.
In paragraph 6, we have:
The issue here is that return types can appear before the declarator-id, so that needs to be accounted for here.
The text was updated successfully, but these errors were encountered: