Title
Inline namespace after simplifications
Status
cd4
Section
9.8.2 [namespace.def]
Submitter
Richard Smith

Created on 2014-12-18.00:00:00 last changed 86 months ago

Messages

Date: 2015-09-15.00:00:00

Proposed resolution (September, 2015):

Change 9.8.2 [namespace.def] paragraph 3 as follows:

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) that was introduced in the declarative region namespace in which the named-namespace-definition appears or that was introduced in a member of the inline namespace set of that namespace, 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.
Date: 2016-02-15.00:00:00

[Adopted at the February, 2016 meeting.]

After the resolution of issue 1795, 9.8.2 [namespace.def] paragraph 3 now says:

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.

This appears to break code like the following:

  namespace A {
    inline namespace b {
      namespace C {
        template<typename T> void f();
      }
    }
  }

  namespace A {
    namespace C {
      template<> void f<int>() { }
    }
  }

because (by definition of “declarative region”) C cannot be used as an unqualified name to refer to A::b::C within A if its declarative region is A::b.

History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: tentatively ready -> cd4
2015-11-10 00:00:00adminsetmessages: + msg5599
2015-11-10 00:00:00adminsetstatus: drafting -> tentatively ready
2014-12-18 00:00:00admincreate