<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 393</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="393"></A><H4>393.
  
Pointer to array of unknown bound in template argument list in parameter
</H4>
<B>Section: </B>9.3.4.6&#160; [<A href="https://wg21.link/dcl.fct">dcl.fct</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Mark Mitchell
 &#160;&#160;&#160;

 <B>Date: </B>12 Dec 2002<BR>


<P>[Moved to DR at the November, 2014 meeting.]</P>

<P>EDG rejects this code:
<PRE>
  template &lt;typename T&gt;
  struct S {};

  void f (S&lt;int (*)[]&gt;);
</PRE>
G++ accepts it.</P>

<P>This is another case where the standard isn't very clear:</P>

<P>The language from 9.3.4.6 [<A href="https://wg21.link/dcl.fct">dcl.fct</A>] is:
 <BLOCKQUOTE>
   If the type of a parameter includes a type of the form "pointer to
   array of unknown bound of T" or "reference to array of unknown bound
   of T," the program is ill-formed.
 </BLOCKQUOTE>
 Since "includes a type" is not a term defined in the standard, we're
 left to guess what this means.  (It would be better if this were a
 recursive definition, the way a type theoretician would do it:
 <UL>
 <LI> Every type includes itself. </LI>
 <LI> T* includes T </LI>
 <LI> T[] includes T </LI>
 <LI> ... </LI>
 </UL>
 )
 </P>

<P><B>Notes from April 2003 meeting:</B></P>

<P>We agreed that the example should be allowed.</P>

<P><B>Additional note (January, 2013):</B></P>

<P>Additional discussion of this issue has arisen
.  For
example, the following is permissible:</P>

<PRE>
  T (*p) [] = (U(*)[])0;
</PRE>

<P>but the following is not:</P>

<PRE>
  template&lt;class T&gt;
  void sp_assert_convertible( T* ) {}

  sp_assert_convertible&lt;T[]&gt;( (U(*)[])0 );
</PRE>



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

<P>Change 9.3.4.6 [<A href="https://wg21.link/dcl.fct#8">dcl.fct</A>] paragraph 8 as follows, including
deleting the footnote:</P>

<BLOCKQUOTE>

<DEL>If the type of a parameter includes a type of the form &#8220;pointer
to array of unknown bound of <TT>T</TT>&#8221; or &#8220;reference to array
of unknown bound of <TT>T</TT>,&#8221; the program is
ill-formed.<SUP>101</SUP></DEL> Functions shall not have a return type of
type array or function, although...

</BLOCKQUOTE>

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