<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1589</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="1589"></A><H4>1589.
  
Ambiguous ranking of list-initialization sequences
</H4>
<B>Section: </B>12.2.4.3&#160; [<A href="https://wg21.link/over.ics.rank">over.ics.rank</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Johannes Schaub
 &#160;&#160;&#160;

 <B>Date: </B>2012-11-21<BR>


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



<P>The interpretation of the following example is unclear in the
current wording:</P>

<PRE>
   void f(long);
   void f(initializer_list&lt;int&gt;);
   int main() { f({1L});
</PRE>

<P>The problem is that a list-initialization sequence can also be
a standard conversion sequence, depending on the types of the elements
and the type of the parameter, so more than one bullet in the list
in 12.2.4.3 [<A href="https://wg21.link/over.ics.rank#3">over.ics.rank</A>] paragraph 3 applies:</P>

<BLOCKQUOTE>

<P>Two implicit conversion sequences of the same form are
indistinguishable conversion sequences unless one of the following
rules applies:</P>

<UL>
<LI><P>Standard conversion sequence <TT>S1</TT> is a better
conversion sequence than standard conversion sequence <TT>S2</TT>
if</P></LI>

<UL>
<LI><P>...</P></LI>

<LI><P>the rank of <TT>S1</TT> is better than the rank of <TT>S2</TT>,
or <TT>S1</TT> and <TT>S2</TT> have the same rank and are
distinguishable by the rules in the paragraph below, or, if not
that,</P></LI>

<LI><P>...</P></LI>

</UL>

<LI><P>...</P></LI>

<LI>

<P>List-initialization sequence <TT>L1</TT> is a better conversion
sequence than list-initialization sequence <TT>L2</TT> if <TT>L1</TT>
converts to <TT>std::initializer_list&lt;X&gt;</TT> for some
<TT>X</TT> and <TT>L2</TT> does not.
</P>
</LI>

</UL>

</BLOCKQUOTE>

<P>These bullets give opposite results for the example above, and
there is implementation variance in which is selected.</P>

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

<P>CWG determined that the latter bullet should apply only if the
first one does not.</P>

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

<P>This issue is resolved by the resolution of
<A HREF="1467.html">issue 1467</A>.</P>

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