<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1369</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="1369"></A><H4>1369.
  
Function invocation substitution of <TT>this</TT>
</H4>
<B>Section: </B>9.2.6&#160; [<A href="https://wg21.link/dcl.constexpr">dcl.constexpr</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Jens Maurer
 &#160;&#160;&#160;

 <B>Date: </B>2011-08-18<BR>


<P>[Voted into the WP at the February, 2012 meeting;
moved to DR at the October, 2012 meeting.]</P>

<P>Function invocation substitution (9.2.6 [<A href="https://wg21.link/dcl.constexpr#5">dcl.constexpr</A>] paragraph 5)
seems underspecified with respect to <TT>this</TT>.</P>

<P><B>Proposed resolution (August, 2011):</B></P>

<OL>
<LI><P>Change the indicated bullet of 7.7 [<A href="https://wg21.link/expr.const#2">expr.const</A>] paragraph 2
as follows:</P></LI>

<UL><LI><P>
<TT>this</TT> (<DEL>7.5 [<A href="https://wg21.link/expr.prim">expr.prim</A>]</DEL>
<INS>_N4567_.5.1.1 [<A href="https://wg21.link/expr.prim.general">expr.prim.general</A>]</INS>) <DEL>unless it appears as the
<I>postfix-expression</I> in a class member access expression,
including the result of the implicit transformation in the body of a
non-static member function (11.4.3 [<A href="https://wg21.link/class.mfct.non.static">class.mfct.non.static</A>])</DEL>
<INS>[<I>Note:</I> when evaluating a constant expression, function
invocation substitution (9.2.6 [<A href="https://wg21.link/dcl.constexpr">dcl.constexpr</A>]) replaces each
occurrence of <TT>this</TT> in a <TT>constexpr</TT> member function
with a pointer to the class object. &#8212;<I>end
note</I>]</INS>;</P></LI></UL>

<LI><P>Change 9.2.6 [<A href="https://wg21.link/dcl.constexpr#5">dcl.constexpr</A>] paragraph 5 as follows
(converting the running text into a bulleted list):</P></LI>

<BLOCKQUOTE>

<P>
<I>Function invocation substitution</I> for a call of a
<I>constexpr</I> function or of a <I>constexpr</I> constructor
means<INS>:</INS>
</P>

<UL>
<LI><P>implicitly converting each argument to the corresponding
parameter type as if by copy-initialization,<SUP>91</SUP>
</P></LI>

<LI><P>substituting that converted expression for each use of the
corresponding parameter in the <I>function-body</I>,</P></LI>

<LI><P>
<INS>in a member function, substituting for each use of
<TT>this</TT> (_N4868_.11.4.3.2 [<A href="https://wg21.link/class.this">class.this</A>]) a prvalue pointer
whose value is the address of the object for which the member
function is called,</INS> and</P></LI>

<LI><P>
<DEL>for</DEL> <INS>in a</INS> <TT>constexpr</TT>
function<DEL>s</DEL>, implicitly converting the resulting returned
expression or <I>braced-init-list</I> to the return type of the
function as if by copy-initialization.</P></LI>

</UL>

<P>Such substitution...</P>

</BLOCKQUOTE>

</OL>

<P>This resolution also resolves issues <A HREF="1264.html">1264</A>
and <A HREF="1367.html">1367</A>.</P>

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