<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1705</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="1705"></A><H4>1705.
  
Unclear specification of &#8220;more specialized&#8221;
</H4>
<B>Section: </B>13.10.3.5&#160; [<A href="https://wg21.link/temp.deduct.partial">temp.deduct.partial</A>]
 &#160;&#160;&#160;

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

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

 <B>Date: </B>2013-06-26<BR>


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



<P>The current wording of 13.10.3.5 [<A href="https://wg21.link/temp.deduct.partial#10">temp.deduct.partial</A>] paragraph 10
is:</P>

<BLOCKQUOTE>

If for each type being considered a given template is at least as
specialized for all types and more specialized for some set of types and
the other template is not more specialized for any types or is not at least
as specialized for any types, then the given template is more specialized
than the other template. Otherwise, neither template is more specialized
than the other.

</BLOCKQUOTE>

<P>This is confusing and needs to be clarified.</P>



<P><B>Proposed resolution (September, 2013) [SUPERSEDED]:</B></P>

<P>Change 13.10.3.5 [<A href="https://wg21.link/temp.deduct.partial">temp.deduct.partial</A>] paragraphs 9 and 10 as follows:</P>

<BLOCKQUOTE>

<P>If, for a given type, deduction succeeds in both directions (i.e., the
types are identical after the transformations above) and both <TT>P</TT>
and <TT>A</TT> were reference types (before being replaced with the type
referred to above):</P>

<UL>
<LI><P>if the type from the argument template was an lvalue reference
and the type from the parameter template was not, <DEL>the argument type is
considered to be more specialized than the other</DEL> <INS>the other type
is not considered to be at least as specialized as the argument type</INS>;
otherwise,</P></LI>

<LI><P>if the type from the argument template is more cv-qualified than the
type from the parameter template (as described above), <DEL>the argument
type is considered to be more specialized than the other; otherwise,</DEL>
<INS>the other type is not considered to be at least as specialized as the
argument type.</INS>
</P></LI>

<LI><P><DEL>neither type is more specialized than the other.</DEL></P></LI>

</UL>

<P>
<DEL>If for each type being considered a given template is at least as
specialized for all types and more specialized for some set of types and
the other template is not more specialized for any types or is not at least
as specialized for any types, then the given template is more specialized
than the other template. Otherwise, neither template is more specialized
than the other.</DEL> <INS>A given template is at least as specialized as
another template if it is at least as specialized as the other template
for all types being considered.  A given template is more specialized than
another template if it is at least as specialized as the other template
for all types being considered, and the other template is not at least as
specialized as the given template for any type being considered.</INS>
</P>

</BLOCKQUOTE>

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

<P>Change 13.10.3.5 [<A href="https://wg21.link/temp.deduct.partial">temp.deduct.partial</A>] paragraphs 9-10 as follows:</P>

<BLOCKQUOTE>

<P>If, for a given type, deduction succeeds in both directions (i.e., the
types are identical after the transformations above) and both <TT>P</TT>
and <TT>A</TT> were reference types (before being replaced with the type
referred to above):</P>

<UL>
<LI><P>if the type from the argument template was an lvalue reference
and the type from the parameter template was not, <DEL>the argument type is
considered to be more specialized than the other</DEL> <INS>the parameter
type is not considered to be at least as specialized as the argument
type</INS>; otherwise,</P></LI>

<LI><P>if the type from the argument template is more cv-qualified than the
type from the parameter template (as described above), <DEL>the argument
type is considered to be more specialized than the other; otherwise,</DEL>
<INS>the parameter type is not considered to be at least as specialized as
the argument type.</INS>
</P></LI>

<LI><P><DEL>neither type is more specialized than the other.</DEL></P></LI>

</UL>

<P>
<DEL>If for each type being considered a given template is at least as
specialized for all types and more specialized for some set of types and
the other template is not more specialized for any types or is not at least
as specialized for any types, then the given template is more specialized
than the other template. Otherwise, neither template is more specialized
than the other.</DEL> <INS>Function template <TT>F</TT> is at least as
specialized as function template <TT>G</TT> if, for each pair of types
used to determine the ordering, the type from <TT>F</TT> is at least as
specialized as the type from <TT>G</TT>. <TT>F</TT> is more specialized
than <TT>G</TT> if <TT>F</TT> is at least as specialized as <TT>G</TT> and
<TT>G</TT> is not at least as specialized as <TT>F</TT>.</INS>
</P>

</BLOCKQUOTE>

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