<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 204</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="204"></A><H4>204.
  
Exported class templates
</H4>
<B>Section: </B>Clause 13&#160; [<A href="https://wg21.link/temp">temp</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Robert Klarer
 &#160;&#160;&#160;

 <B>Date: </B>11 Feb 2000<BR>



<P>[Voted into WP at April 2003 meeting.]</P>

<P>Clause 13 [<A href="https://wg21.link/temp#7">temp</A>] paragraph 7
allows class
templates to be declared exported, including member classes and member
class templates (implicitly by virtue of exporting the
containing template class).  However, paragraph 8 does not exclude
exported class templates from the statement that</P>

<BLOCKQUOTE>
An exported template need only be declared (and not necessarily
defined) in a translation unit in which it is instantiated.
</BLOCKQUOTE>

This is an incorrect implication; however, it is also not dispelled in
13.9.2 [<A href="https://wg21.link/temp.inst#6">temp.inst</A>] paragraph 6:


<BLOCKQUOTE>
If an implicit instantiation of a class template specialization is
required and the template is declared but not defined, the program is
ill-formed.
</BLOCKQUOTE>

This wording says nothing about the translation unit in which the
definition must be provided.  Contrast this with
13.9.3 [<A href="https://wg21.link/temp.explicit#3">temp.explicit</A>] paragraph 3:


<BLOCKQUOTE>
A definition of a class template or a class member template shall be
in scope at the point of the explicit instantiation of the class
template or class member template.
</BLOCKQUOTE>

<P><B>Suggested resolution:</B></P>

<BR><UL>
<LI>Change Clause 13 [<A href="https://wg21.link/temp#8">temp</A>] paragraph 8
to say
that "An exported <INS>non-class</INS> template need only be declared..."</LI>

<LI>Change 13.9.2 [<A href="https://wg21.link/temp.inst#6">temp.inst</A>] paragraph 6
to
use wording similar to that of
13.9.3 [<A href="https://wg21.link/temp.explicit#3">temp.explicit</A>] paragraph 3
regarding
the requirement for a definition of the class template to be in scope.</LI>
</UL>

<P>(See also <A HREF="212.html">issue 212</A>.)</P>

<P><B>Notes from 04/00 meeting:</B></P>

<P>John Spicer opined that even though Clause 13 [<A href="https://wg21.link/temp#7">temp</A>] paragraph 7
speaks of "declaring a class template exported," that does
not mean that the class template is "an exported template" in the
sense of paragraph 8.  He suggested clarifying paragraph 7 to that
effect instead of the change to paragraph 8 suggested above, and
questioned the need for a change to 13.9.2 [<A href="https://wg21.link/temp.inst">temp.inst</A>].</P>

<P><B>Notes from the 4/02 meeting:</B></P>

<P>This is resolved by the proposed changes for
<A HREF="323.html">issue 323</A>.</P>

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