<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 2147</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="2147"></A><H4>2147.
  
Initializer-list arguments and pack deduction
</H4>
<B>Section: </B>13.10.3.2&#160; [<A href="https://wg21.link/temp.deduct.call">temp.deduct.call</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Hubert Tong
 &#160;&#160;&#160;

 <B>Date: </B>2015-06-22<BR>


<P>[Adopted at the February, 2016 meeting.]</P>



<P>The current wording of 13.10.3.2 [<A href="https://wg21.link/temp.deduct.call">temp.deduct.call</A>] paragraph
1 dealing with deduction for a trailing parameter pack refers to
&#8220;the type&#8221; of the argument, which does not apply to
an initializer list.  There is implementation divergence in the
handling of an example like</P>

<PRE>
  #include &lt;initializer_list&gt;

  template &lt;typename... T&gt;
  void q(std::initializer_list&lt;std::initializer_list&lt;T&gt;&gt;... tt);

  void bar() { q({{0}}, {{'\0'}}); }
</PRE>

<P><B>Proposed resolution (September, 2015):</B></P>

<P>Change 13.10.3.2 [<A href="https://wg21.link/temp.deduct.call#1">temp.deduct.call</A>] paragraph 1 as follows:</P>

<BLOCKQUOTE>

...For a function parameter pack that occurs at the end of
the <I>parameter-declaration-list</I>, <DEL>the type <TT>A</TT> of</DEL>
<INS>deduction is performed for</INS> each remaining argument of the
call<INS>,</INS> <DEL>is compared with</DEL> <INS>taking</INS> the
type <TT>P</TT> of the <I>declarator-id</I> of the function parameter
pack <INS>as the corresponding function template parameter type</INS>. Each
<DEL>comparison</DEL> <INS>deduction</INS> deduces template arguments for
subsequent positions in the template parameter packs expanded by the
function parameter pack. When a function parameter pack appears in a
non-deduced context (13.10.3.6 [<A href="https://wg21.link/temp.deduct.type">temp.deduct.type</A>]), the type of that
parameter pack is never deduced. [<I>Example:</I>...

</BLOCKQUOTE>

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