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


1021. Definitions of namespace members

Section: _N4868_.9.8.2.3  [namespace.memdef]     Status: CD4     Submitter: Michael Wong     Date: 2010-01-14

[Moved to DR at the November, 2014 meeting.]

According to _N4868_.9.8.2.3 [namespace.memdef] paragraphs 1 and 2 read,

Members (including explicit specializations of templates (13.9.4 [temp.expl.spec])) of a namespace can be defined within that namespace.

Members of a named namespace can also be defined outside that namespace by explicit qualification (6.5.5.3 [namespace.qual]) of the name being defined, provided that the entity being defined was already declared in the namespace and the definition appears after the point of declaration in a namespace that encloses the declaration's namespace.

It is not clear what these specifications mean for the following pair of examples:

    namespace N {
        struct A;
    }
    using N::A;
    struct A { };

Although this does not satisfy the “by explicit qualification” requirement, it is accepted by major implementations.

    struct S;
    namespace A {
        using ::S;
        struct S  { };
    }

Is this a definition “within that namespace,” or should that wording be interpreted as “directly within” the namespace?

See also issue 1838.

Proposed Resolution (July, 2014):

This issue is resolved by the resolution of issue 1838.