Definitions of namespace members
_N4868_. [namespace.memdef]
Michael Wong

Created on 2010-01-14.00:00:00 last changed 49 months ago


Date: 2014-11-15.00:00:00

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

Date: 2014-07-15.00:00:00

Proposed Resolution (July, 2014):

This issue is resolved by the resolution of issue 1838.

Date: 2021-02-24.00:00:00

According to _N4868_. [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 ( [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.

Date User Action Args
2017-02-06 00:00:00adminsetstatus: drwp -> cd4
2015-05-25 00:00:00adminsetstatus: dr -> drwp
2015-04-13 00:00:00adminsetmessages: + msg5369
2014-11-24 00:00:00adminsetstatus: tentatively ready -> dr
2014-10-13 00:00:00adminsetmessages: + msg5136
2014-10-13 00:00:00adminsetstatus: drafting -> tentatively ready
2014-03-03 00:00:00adminsetstatus: open -> drafting
2010-01-14 00:00:00admincreate