<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 546</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="546"></A><H4>546.
  
Explicit instantiation of class template members
</H4>
<B>Section: </B>13.9.3&#160; [<A href="https://wg21.link/temp.explicit">temp.explicit</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Martin Sebor
 &#160;&#160;&#160;

 <B>Date: </B>29 October 2005<BR>


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

<P>
<A HREF="470.html">Issue 470</A> specified the explicit
instantiation of members of explicitly-instantiated class templates.
In restricting the affected members to those &#8220;whose definition
is visible at the point of instantiation,&#8221; however, this
resolution introduced an incompatibility between explicitly
instantiating a member function or static data member and explicitly
instantiating the class template of which it is a member (13.9.3 [<A href="https://wg21.link/temp.explicit#3">temp.explicit</A>] paragraph 3 requires only that the class template
definition, not that of the member function or static data member, be
visible at the point of the explicit instantiation).  It would be
better to treat the member instantiations the same, regardless of
whether they are directly or indirectly explicitly instantiated.</P>

<P><B>Notes from the April, 2006 meeting:</B></P>

<P>In forwarding document J16/06-0057 = WG21 N1987 to be approved by
the full Committee, the CWG reaffirmed its position that explicitly
instantiating a class template only explicitly instantiates those of
its members that have been defined before the point of the explicit
instantiation.  The effect of the position advocated above would be to
require all non-exported member functions to be defined in the
translation unit in which the class template is explicitly
instantiated (cf paragraph 4), and we did not want to require that.
We did agree that the &#8220;visible&#8221; terminology should be
replaced by wording along the lines of &#8220;has been
defined.&#8221;</P>

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

<P>Change 13.9.3 [<A href="https://wg21.link/temp.explicit#8">temp.explicit</A>] paragraph 8 as follows:</P>

<BLOCKQUOTE>

An explicit instantiation definition that names a class template
specialization explicitly instantiates the class template
specialization and is only an explicit instantiation definition
of members <DEL>whose definition is visible</DEL> <INS>that have
been defined</INS> at the point of instantiation.

</BLOCKQUOTE>

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