<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1113</TITLE>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<STYLE TYPE="text/css">
  INS { text-decoration:none; font-weight:bold; background-color:#A0FFA0 }
  .INS { text-decoration:none; background-color:#D0FFD0 }
  DEL { text-decoration:line-through; background-color:#FFA0A0 }
  .DEL { text-decoration:line-through; background-color: #FFD0D0 }
  @media (prefers-color-scheme: dark) {
    HTML { background-color:#202020; color:#f0f0f0; }
    A { color:#5bc0ff; }
    A:visited { color:#c6a8ff; }
    A:hover, a:focus { color:#afd7ff; }
    INS { background-color:#033a16; color:#aff5b4; }
    .INS { background-color: #033a16; }
    DEL { background-color:#67060c; color:#ffdcd7; }
    .DEL { background-color:#67060c; }
  }
  SPAN.cmnt { font-family:Times; font-style:italic }
</STYLE>
</HEAD>
<BODY>
<P><EM>This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21
  Core Issues List revision 118b.
  See http://www.open-std.org/jtc1/sc22/wg21/ for the official
  list.</EM></P>
<P>2025-09-28</P>
<HR>
<A NAME="1113"></A><H4>1113.
  
Linkage of namespace member of unnamed namespace
</H4>
<B>Section: </B>6.7&#160; [<A href="https://wg21.link/basic.link">basic.link</A>]
 &#160;&#160;&#160;

 <B>Status: </B>C++11
 &#160;&#160;&#160;

 <B>Submitter: </B>DE
 &#160;&#160;&#160;

 <B>Date: </B>2010-08-02<BR><BR>


<P>[Voted into the WP at the November, 2010 meeting.]</P>

<A href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3296.html#DE4">N3092 comment
  DE&#160;4<BR></A>

<P>It is odd that, in the following example, <TT>N</TT> has no
linkage but <TT>g</TT> has external linkage:</P>

<PRE>
    namespace {
      namespace N // has no linkage
      {
        void g(); // has external linkage
      }
    }
</PRE>

<P><B>Proposed resolution (August, 2010):</B></P>

<P>Change 6.7 [<A href="https://wg21.link/basic.link#4">basic.link</A>] paragraph 4 as follows:</P>

<BLOCKQUOTE>

<INS>An unnamed namespace or a namespace declared directly
or indirectly within an unnamed namespace has internal
linkage. All other namespaces have external linkage.</INS> A
name having namespace scope <INS>that has not been given
internal linkage above</INS> has <DEL>external linkage</DEL>
<INS>the same linkage as the enclosing namespace</INS> if it
is the name of

<UL>
<LI><P>a variable<DEL>, unless it has internal
linkage</DEL>; or</P></LI>

<LI><P>a function<DEL>, unless it has internal
linkage</DEL>; or</P></LI>

<LI><P>a named class (Clause 11 [<A href="https://wg21.link/class">class</A>]), or an
unnamed class defined in a typedef declaration in which the
class has the typedef name for linkage purposes
(9.2.4 [<A href="https://wg21.link/dcl.typedef">dcl.typedef</A>]); or</P></LI>

<LI><P>a named enumeration (9.8.1 [<A href="https://wg21.link/dcl.enum">dcl.enum</A>]), or an
unnamed enumeration defined in a typedef declaration in
which the enumeration has the typedef name for linkage
purposes (9.2.4 [<A href="https://wg21.link/dcl.typedef">dcl.typedef</A>]); or</P></LI>

<LI><P>an enumerator belonging to an enumeration with
<DEL>external</DEL> linkage; or</P></LI>

<LI><P>a template<DEL>, unless it is a function template
that has internal linkage (Clause 13 [<A href="https://wg21.link/temp">temp</A>]);
or</DEL><INS>.</INS>
</P></LI>

<LI><P><DEL>a namespace (9.9 [<A href="https://wg21.link/basic.namespace">basic.namespace</A>]), unless it is
declared within an unnamed namespace.</DEL></P></LI>

</UL>

</BLOCKQUOTE>

<BR><BR>
</BODY>
</HTML>
