<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 564</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="564"></A><H4>564.
  
Agreement of language linkage or <I>linkage-specification</I>s?
</H4>
<B>Section: </B>9.12&#160; [<A href="https://wg21.link/dcl.link">dcl.link</A>]
 &#160;&#160;&#160;

 <B>Status: </B>CD2
 &#160;&#160;&#160;

 <B>Submitter: </B>Daveed Vandevoorde
 &#160;&#160;&#160;

 <B>Date: </B>8 March 2006<BR>


<P>[Voted into the WP at the March, 2009 meeting.]</P>

<P>The wording of 9.12 [<A href="https://wg21.link/dcl.link#5">dcl.link</A>] paragraph 5 is suspect:</P>

<BLOCKQUOTE>

If two declarations of the same function or object specify different
<I>linkage-specification</I>s (that is,
the <I>linkage-specification</I>s of these declarations specify
different <I>string-literal</I>s), the program is ill-formed if the
declarations appear in the same translation unit, and the one
definition rule (3.2) applies if the declarations appear in different
translation units.

</BLOCKQUOTE>

<P>But what if only one of the declarations has a
<I>linkage-specification</I>, while the other is left with the
default C++ linkage?  Shouldn't this restriction be phrased in terms
of the functions&#8217; or objects&#8217; language linkage rather than
<I>linkage-specification</I>s?</P>

<P>(<I>Additional note [wmm]:</I> Is the ODR the proper vehicle for
enforcing this requirement?  This is dealing with declarations, not
necessarily definitions.  Shouldn't this say &#8220;ill-formed, no
diagnostic required&#8221; instead of some vague reference to the ODR?)</P>

<P><B>Proposed resolution (June, 2008):</B></P>

<P>Change 9.12 [<A href="https://wg21.link/dcl.link#5">dcl.link</A>] paragraph 5 as follows:</P>

<BLOCKQUOTE>

If two declarations <DEL>of the same function or object</DEL> <INS>declare
functions with the same name and parameter-type-list (9.3.4.6 [<A href="https://wg21.link/dcl.fct">dcl.fct</A>]) to be members of the same namespace or declare objects
with the same name to be members of the same namespace</INS> <DEL>specify
different <I>linkage-specification</I>s (that is, the
<I>linkage-specification</I>s of these declarations specify different
<I>string-literal</I>s)</DEL> <INS>and the declarations give the names
different language linkages</INS>, the program is ill-formed<DEL> if the
declarations appear in the same translation unit, and the one
definition rule (6.3 [<A href="https://wg21.link/basic.def.odr">basic.def.odr</A>]) applies</DEL><INS>; no
diagnostic is required</INS> if the declarations appear in different
translation units.

</BLOCKQUOTE>

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