This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115g. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-12-16


2165. Namespaces, declarative regions, and translation units

Section: _N4868_.6.4.1  [basic.scope.declarative]     Status: CD6     Submitter: Richard Smith     Date: 2015-07-30

[Accepted at the November, 2020 meeting as part of paper P1787R6 and moved to DR at the February, 2021 meeting.]

The definition of “declarative region” given in _N4868_.6.4.1 [basic.scope.declarative] paragraph 1 is,

Every name is introduced in some portion of program text called a declarative region, which is the largest part of the program in which that name is valid, that is, in which that name may be used as an unqualified name to refer to the same entity.

According to 9.8 [basic.namespace] paragraph 1,

Unlike other declarative regions, the definition of a namespace can be split over several parts of one or more translation units.

This seems like a misuse of the term “declarative region”; in particular, a name x declared in namespace N in translation unit A cannot be used as an unqualified name in the part of namespace N in translation unit B unless it is also declared in B. See also issue 1884.