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

 <B>Status: </B>C++17
 &#160;&#160;&#160;

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

 <B>Date: </B>2015-12-01<BR>


<P>[Adopted at the February/March, 2017 meeting.]</P>

<P>Consider an example like</P>

<PRE>
  void *p;
  void (*pf)();
  auto x = true ? p : pf;
</PRE>

<P>The rules in Clause 7 [<A href="https://wg21.link/expr#13">expr</A>] paragraph 13 say that the composite
type between a <TT>void*</TT> and a function pointer type is
<TT>void*</TT>. This is surprising, since a function pointer type
cannot be implicitly converted to <TT>void*</TT>.</P>

<P><B>Proposed resolution (January, 2017):</B></P>

<P>Change Clause 7 [<A href="https://wg21.link/expr#14.5">expr</A>] bullet 14.5 as follows:</P>

<BLOCKQUOTE>

<P>The <I>cv-combined type</I> of two types <TT>T1</TT> and <TT>T2</TT> is
a type <TT>T3</TT> similar to <TT>T1</TT> whose cv-qualification signature
(7.3.6 [<A href="https://wg21.link/conv.qual">conv.qual</A>]) is:</P>

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

<LI><P>if <TT>T1</TT> or <TT>T2</TT> is &#8220;pointer to <I>cv1</I>
<TT>void</TT>&#8221; and the other type is &#8220;pointer to <I>cv2</I>
<TT>T</TT>&#8221;, <INS>where <TT>T</TT> is an object type or
<TT>void</TT>,</INS> &#8220;pointer to <I>cv12</I> <TT>void</TT>&#8221;,
where <I>cv12</I> is the union of <I>cv1</I> and <I>cv2</I>;</P></LI>

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

</UL>

</BLOCKQUOTE>

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