This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-10-26
[Moved to DR at the November, 2014 meeting.]
According to 9.8.2 [namespace.def] paragraph 2,
The identifier in an original-namespace-definition shall not have been previously defined in the declarative region in which the original-namespace-definition appears.
Apparently the intent of this requirement is to say that, given the declarations
namespace N { } namespace N { }
the second declaration is to be taken as an extension-namespace-definition and not an original-namespace-definition, since the general rules in _N4868_.6.4.1 [basic.scope.declarative] cover the case in which the identifier has been previously declared as something other than a namespace.
This use of “shall” for disambiguation is novel, however, and it would be better to replace it with a specific statement addressing disambiguation in paragraphs 2 and 3.
Proposed Resolution (July, 2014):
Change 6.4.6 [basic.scope.namespace] paragraph 1 as follows:
The declarative region of a namespace-definition is its namespace-body.The potential scope denoted by an original-namespace-name is the concatenation of the declarative regions established by each of the namespace-definitions in the same declarative region with that original-namespace-name.Entities declared in a namespace-body...
Change 9.8.2 [namespace.def] paragraphs 1-4 as follows:
The grammar for a namespace-definition is
namespace-name:
original-namespace-nameidentifier
namespace-alias
original-namespace-name:
identifiernamespace-definition:
named-namespace-definition
unnamed-namespace-definitionnamed-namespace-definition:
original-namespace-definition
extension-namespace-definition
original-namespace-definition:inlineopt namespace identifier { namespace-body }
extension-namespace-definition:
inlineopt namespace original-namespace-name { namespace-body }unnamed-namespace-definition:
inlineopt namespace { namespace-body }
namespace-body:
declaration-seqopt
The identifier in an original-namespace-definition shall not have been previously defined in the declarative region in which the original-namespace-definition appears. The identifier in an original-namespace-definition is the name of the namespace. Subsequently in that declarative region, it is treated as an original-namespace-name.
The original-namespace-name in an extension-namespace-definition shall have previously been defined in an original-namespace-definition in the same declarative region.Every namespace-definition shall appear in the global scope or in a namespace scope (6.4.6 [basic.scope.namespace]).
In a named-namespace-definition, the identifier is the name of the namespace. If the identifier, when looked up (6.5.3 [basic.lookup.unqual]), refers to a namespace-name (but not a namespace-alias) introduced in the declarative region in which the named-namespace-definition appears, the namespace-definition extends the previously-declared namespace. Otherwise, the identifier is introduced as a namespace-name into the declarative region in which the named-namespace-definition appears.
Change 9.8.2 [namespace.def] paragraph 7 as follows:
If the optional initial inline keyword appears in a namespace-definition for a particular namespace, that namespace is declared to be an inline namespace. The inline keyword may be used onan extension-namespace-definitiona namespace-definition that extends a namespace only if it was previously used on theoriginal-namespace-definitionnamespace-definition that initially declared the namespace-name for that namespace.
Delete 9.8.3 [namespace.alias] paragraph 4:
A namespace-name or namespace-alias shall not be declared as the name of any other entity in the same declarative region. A namespace-name defined at global scope shall not be declared as the name of any other entity in any global scope of the program. No diagnostic is required for a violation of this rule by declarations in different translation units.
Change 9.8.4 [namespace.udir] paragraph 5 as follows:
If a namespace is extendedby an extension-namespace-definitionafter a using-directive for that namespace is given, the additional members of the extended namespace and the members of namespaces nominated by using-directives in theextension-namespace-definitionextending namespace-definition can be used after theextension-namespace-definitionextending namespace-definition.