<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 2534</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="2534"></A><H4>2534.
  
Value category of pseudo-destructor expression
</H4>
<B>Section: </B>7.6.1.5&#160; [<A href="https://wg21.link/expr.ref">expr.ref</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Andrey Erokhin
 &#160;&#160;&#160;

 <B>Date: </B>2022-02-17<BR>


<P>[Accepted at the July, 2022 meeting.]</P>

<P>Subclause 7.6.1.5 [<A href="https://wg21.link/expr.ref#3">expr.ref</A>] paragraph 3 defines the value
category of a pseudo-destructor class member access expression to be
an lvalue:</P>

<BLOCKQUOTE>

Abbreviating <I>postfix-expression</I>.<I>id-expression</I> as E1.E2,
E1 is called the <I>object expression</I>. If the object expression is
of scalar type, E2 shall name the pseudo-destructor of that same type
(ignoring cv-qualifications) and E1.E2 is an lvalue of type
&#8220;function of () returning <TT>void</TT>&#8221;.

</BLOCKQUOTE>

This is inconsistent with the analogous situation naming the
destructor of a class.  In that case, the class member access
expression is a prvalue, not an lvalue, as specified in
7.6.1.5 [<A href="https://wg21.link/expr.ref#6.3">expr.ref</A>] bullet 6.3
(see also <A HREF="2458.html">issue 2458</A>):

<BLOCKQUOTE>

<UL>
<LI>If E2 is an overload set, function overload resolution
(12.2 [<A href="https://wg21.link/over.match">over.match</A>]) is used to select the function to which E2
refers. The type of E1.E2 is the type of E2 and E1.E2 refers to the
function referred to by E2.
<UL>
<LI>If E2 refers to a static member function, E1.E2 is an lvalue.</LI>
<LI>Otherwise (when E2 refers to a non-static member function), E1.E2 is a prvalue. The expression can be
used only as the left-hand operand of a member function call
(11.4.2 [<A href="https://wg21.link/class.mfct">class.mfct</A>]).</LI>
</UL>
</LI>
</UL>

</BLOCKQUOTE>

It also contradicts 7.2.1 [<A href="https://wg21.link/basic.lval#1.1">basic.lval</A>] bullet 1.1:

<BLOCKQUOTE>

<UL>
<LI>A <I>glvalue</I> is an expression whose evaluation determines the
identity of an object or function.</LI>
</UL>

</BLOCKQUOTE>

A pseudo-destructor does not have an identity.

<P><B>Proposed resolution (approved by CWG 2022-04-08):</B></P>

<P>Change 7.6.1.5 [<A href="https://wg21.link/expr.ref#3">expr.ref</A>] paragraph 3 as follows:</P>

<BLOCKQUOTE>

If the object expression is of scalar type, E2 shall name the
pseudo-destructor of that same type (ignoring cv-qualifications) and
E1.E2 is <DEL>an lvalue</DEL> <INS>a prvalue</INS> of type
&#8220;function of () returning <TT>void</TT>&#8221;.

</BLOCKQUOTE>

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