Title
Linkage of namespace member of unnamed namespace
Status
c++11
Section
6.6 [basic.link]
Submitter
DE

Created on 2010-08-02.00:00:00 last changed 123 months ago

Messages

Date: 2010-11-15.00:00:00

[Voted into the WP at the November, 2010 meeting.]

Date: 2010-08-15.00:00:00

Proposed resolution (August, 2010):

Change 6.6 [basic.link] paragraph 4 as follows:

An unnamed namespace or a namespace declared directly or indirectly within an unnamed namespace has internal linkage. All other namespaces have external linkage. A name having namespace scope that has not been given internal linkage above has external linkage the same linkage as the enclosing namespace if it is the name of
  • a variable, unless it has internal linkage; or

  • a function, unless it has internal linkage; or

  • a named class (Clause 11 [class]), or an unnamed class defined in a typedef declaration in which the class has the typedef name for linkage purposes (9.2.4 [dcl.typedef]); or

  • a named enumeration (9.7.1 [dcl.enum]), or an unnamed enumeration defined in a typedef declaration in which the enumeration has the typedef name for linkage purposes (9.2.4 [dcl.typedef]); or

  • an enumerator belonging to an enumeration with external linkage; or

  • a template, unless it is a function template that has internal linkage (Clause 13 [temp]); or.

  • a namespace (9.8 [basic.namespace]), unless it is declared within an unnamed namespace.

Date: 2010-08-02.00:00:00
N3092 comment DEĀ 4

It is odd that, in the following example, N has no linkage but g has external linkage:

    namespace {
      namespace N // has no linkage
      {
        void g(); // has external linkage
      }
    }
History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetstatus: dr -> fdis
2010-11-29 00:00:00adminsetmessages: + msg3146
2010-11-29 00:00:00adminsetstatus: ready -> dr
2010-08-23 00:00:00adminsetmessages: + msg2760
2010-08-02 00:00:00admincreate