<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1088</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="1088"></A><H4>1088.
  
Dependent non-type template arguments
</H4>
<B>Section: </B>13.8.3.4&#160; [<A href="https://wg21.link/temp.dep.constexpr">temp.dep.constexpr</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Jason Merrill
 &#160;&#160;&#160;

 <B>Date: </B>2010-06-28<BR>


<P>[Voted into the WP at the March, 2011 meeting as part of paper N3262.]</P>



<P>Given</P>

<PRE>
    template &lt;const char *N&gt; struct A { static const char *p; };
    template &lt;class T&gt;
       struct B { static const char c[1]; typedef A&lt;B&lt;T&gt;::c&gt; C; };
    template &lt;class T&gt;
       struct D { static const char c[1]; typedef A&lt;c&gt; C; };
</PRE>

<P>13.8.3.7 [<A href="https://wg21.link/temp.dep.temp">temp.dep.temp</A>] says that <TT>B&lt;T&gt;::c</TT> is
dependent because it is used as a non-integral non-type template
argument and it is a <I>qualified-id</I> with a
<I>nested-name-specifier</I> that names a dependent type.</P>

<P>There doesn't seem to be anything to say that <TT>c</TT> in the
definition of <TT>D&lt;T&gt;::C</TT> is dependent, which suggests that
<TT>D&lt;T&gt;::C</TT> is the same type for all <TT>T</TT>, which is
clearly false.</P>

<P>Instead of this special rule in 13.8.3.7 [<A href="https://wg21.link/temp.dep.temp">temp.dep.temp</A>],
13.8.3.4 [<A href="https://wg21.link/temp.dep.constexpr">temp.dep.constexpr</A>] should say that the address of a member
of a dependent type is value-dependent, regardless of whether the
address is written with a <I>qualified-id</I>.</P>

<P><B>Proposed resolution (November, 2010) [SUPERSEDED]:</B></P>

<OL>
<LI><P>Add a new paragraph at the end of
13.8.3.4 [<A href="https://wg21.link/temp.dep.constexpr">temp.dep.constexpr</A>]:</P></LI>

<BLOCKQUOTE>

<INS>An <I>id-expression</I> is value-dependent if it names a member
of an unknown specialization.</INS>

</BLOCKQUOTE>

<LI><P>Change 13.8.3.7 [<A href="https://wg21.link/temp.dep.temp">temp.dep.temp</A>] paragraphs 2-3 as follows:</P></LI>

<BLOCKQUOTE>

<P>
<DEL>An integral</DEL> <INS>A</INS> non-type
<I>template-argument</I> is dependent if <INS>its type is dependent
or</INS> the constant expression it specifies is value-dependent.</P>

<P>
<DEL>A non-integral</DEL> <INS>Furthermore, a</INS> non-type
<I>template-argument</I> is dependent if <DEL>its type is dependent or it
has either of the following forms</DEL>
</P>

<UL><DEL><I>qualified-id</I></DEL></UL>
<UL><DEL><TT>&amp;</TT> <I>qualified-id</I></DEL></UL>

<P>
<DEL>and contains a <I>nested-name-specifier</I> which specifies a
<I>class-name</I> that names a dependent type</DEL> <INS>the
corresponding non-type <I>template-parameter</I> is of reference or
pointer type and the <I>template-argument</I> designates or points to
a member of the current instantiation or a member of a dependent
type</INS>.</P>

</BLOCKQUOTE>

</OL>

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