<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 187</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="187"></A><H4>187.
  
Scope of template parameter names
</H4>
<B>Section: </B>13.2&#160; [<A href="https://wg21.link/temp.param">temp.param</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>John Spicer
 &#160;&#160;&#160;

 <B>Date: </B>15 Nov 1999<BR>





<P>At the Dublin meeting (04/99), the Committee proposed to resolve
<A HREF="22.html">issue 22</A> by simply changing the
wording to make clear that a template parameter cannot be used in its
own default argument.  This creates a third treatment of this kind of
situation, in addition to
6.4.2 [<A href="https://wg21.link/basic.scope.pdecl#1">basic.scope.pdecl</A>] paragraph 1,
 where
declarators are in scope and can be used in their initializers, and
paragraph 3, where an enumerator is not in scope until after its
complete <I>enumerator-definition</I>.  The Dublin resolution is for
the template parameter to be in scope in its default argument but not
usable.  It would be more consistent to treat template parameters like
enumerators: simply not in scope until the entire
<I>template-parameter</I> declaration is seen.</P>

<P>On a related note,
13.2 [<A href="https://wg21.link/temp.param#14">temp.param</A>] paragraph 14
should be
rewritten to connect the prohibition with visibility rules; otherwise,
it sounds as if the following example is not permitted:</P>

<PRE>
    const int Z = 1;
    template &lt;int X = Z, int Z&gt; class A {};
</PRE>

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

<P>The core working group did not reach consensus on the suggested
approach to <A HREF="22.html">issue 22</A>.  However, it was
agreed that the intent expressed in the earlier resolution would be
better served by different wording.</P>

<P><B>Proposed resolution (10/00):</B></P>

<P><I>[Note: This resolution supersedes the resolution to
<A HREF="22.html">issue 22</A>.]</I></P>

<P>Replace 13.2 [<A href="https://wg21.link/temp.param#14">temp.param</A>] paragraph 14 as follows:</P>

<BLOCKQUOTE>
A template parameter shall not be used in its own default argument.
</BLOCKQUOTE>

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