<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 2381</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="2381"></A><H4>2381.
  
Composite pointer type of pointers to plain and noexcept member functions
</H4>
<B>Section: </B>7.2.2&#160; [<A href="https://wg21.link/expr.type">expr.type</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Mike Miller
 &#160;&#160;&#160;

 <B>Date: </B>2018-06-19<BR>


<P>[Accepted as a DR at the February, 2019 meeting.]</P>

<P>According to 7.3.14 [<A href="https://wg21.link/conv.fctptr#1">conv.fctptr</A>] paragraph 1,</P>

<BLOCKQUOTE>

A prvalue of type &#8220;pointer to member of type <TT>noexcept</TT>
function&#8221; can be converted to a prvalue of type
&#8220;pointer to member of type function&#8221;. The result
designates the member function.

</BLOCKQUOTE>

<P>However, 7.2.2 [<A href="https://wg21.link/expr.type#4">expr.type</A>] paragraph 4 does not
allow for this conversion in determining the composite
pointer type of two pointers to member functions. The
corresponding conversion is considered for pointers to
non-member functions, but only qualification conversions are
considered for pointers to members:</P>

<BLOCKQUOTE>

<P>The <I>composite pointer type</I> of two
operands <TT>p1</TT> and <TT>p2</TT> having
types <TT>T1</TT> and <TT>T2</TT>, respectively, where at
least one is a pointer or pointer-to-member type
or <TT>std::nullptr_t</TT>, is:</P>

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

<LI><P>if <TT>T1</TT> or <TT>T2</TT> is &#8220;pointer to
noexcept function&#8221; and the other type is
&#8220;pointer to function&#8221;, where the function types
are otherwise the same, &#8220;pointer to
function&#8221;;</P></LI>

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

<LI>

<P>if <TT>T1</TT> is &#8220;pointer to member of <TT>C1</TT>
of type <I>cv1</I> <TT>U1</TT>&#8221; and <TT>T2</TT>
is &#8220;pointer to member of <TT>C2</TT> of type <I>cv2</I>
<TT>U2</TT>&#8221; where <TT>C1</TT> is reference-related
to <TT>C2</TT> or <TT>C2</TT> is reference-related
to <TT>C1</TT> (9.5.4 [<A href="https://wg21.link/dcl.init.ref">dcl.init.ref</A>]), the cv-combined
type of <TT>T2</TT> and <TT>T1</TT> or the cv-combined type
of <TT>T1</TT> and <TT>T2</TT>, respectively;</P>
</LI>

</UL>

</BLOCKQUOTE>

<P>Note also that the places that refer to &#8220;composite
pointer type&#8221; only refer to 7.3.13 [<A href="https://wg21.link/conv.mem">conv.mem</A>]
for conversions involving pointers to members, omitting any
reference to 7.3.14 [<A href="https://wg21.link/conv.fctptr">conv.fctptr</A>] for pointers to
member functions. This affects 7.6.9 [<A href="https://wg21.link/expr.rel">expr.rel</A>],
7.6.10 [<A href="https://wg21.link/expr.eq">expr.eq</A>], and 7.6.16 [<A href="https://wg21.link/expr.cond">expr.cond</A>].</P>

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

<OL>
<LI><P>Change 7.2.2 [<A href="https://wg21.link/expr.type#4">expr.type</A>] paragraph 4 as follows:</P></LI>

<BLOCKQUOTE>

<P>The <I>composite pointer type</I> of two
operands <TT>p1</TT> and <TT>p2</TT> having
types <TT>T1</TT> and <TT>T2</TT>, respectively, where at
least one is a pointer or pointer-to-member type
or <TT>std::nullptr_t</TT>, is:</P>

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

<LI><P><INS>if <TT>T1</TT> or <TT>T2</TT> is &#8220;pointer
to member of <TT>C1</TT> of type function&#8221;, the other
type is &#8220;pointer to member of <TT>C2</TT> of type
<TT>noexcept</TT> function&#8221;, and <TT>C1</TT> is
reference-related to <TT>C2</TT> or <TT>C2</TT> is
reference-related to <TT>C1</TT> (9.5.4 [<A href="https://wg21.link/dcl.init.ref">dcl.init.ref</A>]),
where the function types are otherwise the same, &#8220;pointer
to member of <TT>C2</TT> of type function&#8221; or
&#8220;pointer to member of <TT>C1</TT> of type function&#8221;,
respectively;</INS></P></LI>

<LI><P>if <TT>T1</TT> is &#8220;pointer to member
of <TT>C1</TT> of type <I>cv1</I> <DEL><TT>U1</TT></DEL>
<INS><TT>U</TT></INS>&#8221;
and <TT>T2</TT> is &#8220;pointer to member of <TT>C2</TT>
of type <I>cv2</I> <DEL><TT>U2</TT></DEL>
<INS><TT>U</TT></INS>&#8221;<INS>, for some non-function
type <TT>U</TT>,</INS> where <TT>C1</TT> is
reference-related to <TT>C2</TT> or <TT>C2</TT> is
reference-related to <TT>C1</TT>
(9.5.4 [<A href="https://wg21.link/dcl.init.ref">dcl.init.ref</A>]), the cv-combined type
of <TT>T2</TT> and <TT>T1</TT> or the cv-combined type
of <TT>T1</TT> and <TT>T2</TT>, respectively;</P></LI>

</UL>

</BLOCKQUOTE>

<LI><P>Change 7.6.10 [<A href="https://wg21.link/expr.eq#4">expr.eq</A>] paragraph 4 as follows:</P></LI>

<BLOCKQUOTE>

If at least one of the operands is a pointer to member,
pointer-to-member conversions (7.3.13 [<A href="https://wg21.link/conv.mem">conv.mem</A>])<INS>,
function pointer conversions (7.3.14 [<A href="https://wg21.link/conv.fctptr">conv.fctptr</A>]),</INS>
and qualification conversions (7.3.6 [<A href="https://wg21.link/conv.qual">conv.qual</A>])
are performed on both operands to bring them to their
composite pointer type (7.2 [<A href="https://wg21.link/expr.prop">expr.prop</A>]).
Comparing...

</BLOCKQUOTE>

<LI><P>Change 7.6.16 [<A href="https://wg21.link/expr.cond#7.4">expr.cond</A>] bullet 7.4 as follows:</P></LI>

<BLOCKQUOTE>

<P>Lvalue-to-rvalue (7.3.2 [<A href="https://wg21.link/conv.lval">conv.lval</A>]),
array-to-pointer (7.3.3 [<A href="https://wg21.link/conv.array">conv.array</A>]), and
function-to-pointer (7.3.4 [<A href="https://wg21.link/conv.func">conv.func</A>]) standard
conversions are performed on the second and third
operands. After those conversions, one of the following
shall hold:</P>

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

<LI><P>One or both of the second and third operands have
pointer-to-member type; pointer to member conversions
(7.3.13 [<A href="https://wg21.link/conv.mem">conv.mem</A>])<INS>, function pointer
conversions (7.3.14 [<A href="https://wg21.link/conv.fctptr">conv.fctptr</A>]),</INS> and
qualification conversions (7.3.6 [<A href="https://wg21.link/conv.qual">conv.qual</A>]) are
performed to bring them to their composite pointer type
(7.2 [<A href="https://wg21.link/expr.prop">expr.prop</A>]). The result is of the composite
pointer type.</P></LI>

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

</UL>

</BLOCKQUOTE>

</OL>

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