<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1401</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="1401"></A><H4>1401.
  
Similar types and reference compatibility
</H4>
<B>Section: </B>9.5.4&#160; [<A href="https://wg21.link/dcl.init.ref">dcl.init.ref</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Daniel Kr&#252;gler
 &#160;&#160;&#160;

 <B>Date: </B>2011-10-03<BR>


<P>[Moved to DR at the October, 2012 meeting.]</P>



<P>The definition of reference-compatible types in
9.5.4 [<A href="https://wg21.link/dcl.init.ref#4">dcl.init.ref</A>] paragraph 4 allows the types to differ
in top-level cv-qualification, but it does not encompass the deeper
added cv-qualification permitted for &#8220;similar types&#8221;
(7.3.6 [<A href="https://wg21.link/conv.qual">conv.qual</A>]).  This seems surprising and could lead
to errors resulting from the fact that the reference will be bound
to a temporary and not to the original object in the initializer.</P>

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

<OL>
<LI><P>Change 9.5.4 [<A href="https://wg21.link/dcl.init.ref#4">dcl.init.ref</A>] paragraph 4 as follows:</P></LI>

<BLOCKQUOTE>

Given types &#8220;<I>cv1</I> <TT>T1</TT>&#8221; and &#8220;<I>cv2</I>
<TT>T2</TT>,&#8221; &#8220;<I>cv1</I> <TT>T1</TT>&#8221; is
reference-related to &#8220;<I>cv2</I> <TT>T2</TT>&#8221; if
<TT>T1</TT> is the same type as <TT>T2</TT>, or <TT>T1</TT> is a base
class of <TT>T2</TT>. &#8220;<I>cv1</I> <TT>T1</TT>&#8221; is
reference-compatible with &#8220;<I>cv2</I> <TT>T2</TT>&#8221; if
<TT>T1</TT> is reference-related to <TT>T2</TT> and <I>cv1</I> is the
same cv-qualification as, or greater cv-qualification than,
<I>cv2</I>.  <DEL>For purposes of overload resolution, cases for which
<I>cv1</I> is greater cv-qualification than <I>cv2</I> are identified
as <I>reference-compatible with added qualification</I> (see
12.2.4.3 [<A href="https://wg21.link/over.ics.rank">over.ics.rank</A>]).</DEL>  In all cases...

</BLOCKQUOTE>

<LI><P>Delete 12.2.4.2.5 [<A href="https://wg21.link/over.ics.ref#5">over.ics.ref</A>] paragraph 5:</P></LI>

<BLOCKQUOTE>

<DEL>The binding of a reference to an expression that is
<I>reference-compatible with added qualification</I> influences the
rank of a standard conversion; see 12.2.4.3 [<A href="https://wg21.link/over.ics.rank">over.ics.rank</A>] and
9.5.4 [<A href="https://wg21.link/dcl.init.ref">dcl.init.ref</A>].</DEL>

</BLOCKQUOTE>

<P><I>[Drafting note: CWG decided not to make a substantive change for
this issue, but the investigation discovered that the term defined by
these two citations is not actually used and could be
removed.]</I></P>

</OL>

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