<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1726</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="1726"></A><H4>1726.
  
Declarator operators and conversion function
</H4>
<B>Section: </B>11.4.8.3&#160; [<A href="https://wg21.link/class.conv.fct">class.conv.fct</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>James Widman
 &#160;&#160;&#160;

 <B>Date: </B>2013-08-02<BR>


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



<P>Presumably the following example is intended to be ill-formed:</P>

<PRE>
  struct A {
    (*operator int*());
  };
  A a;
  int *x = a; //<SPAN CLASS="cmnt"> Ok?</SPAN>
</PRE>

<P>It is not clear, however, which rule is supposed to reject such a
<I>member-declaration</I>.</P>

<P><B>Proposed resolution (December, 2021):</B></P>

<P>Change 11.4.8.3 [<A href="https://wg21.link/class.conv.fct#1">class.conv.fct</A>] paragraph 1 as follows,
splitting the paragraph as indicated:</P>

<BLOCKQUOTE>

<P><DEL>A member function of a class <TT>X</TT> with a name of
the form</DEL></P>

<UL>
<I>conversion-function-id:</I>
<UL>
<TT>operator</TT> <I>conversion-type-id</I>
</UL>
</UL>
<UL>
<I>conversion-type-id:</I>
<UL>
<I>type-specifier-seq conversion-declarator<SUB>opt</SUB></I>
</UL>
</UL>
<UL>
<I>conversion-declarator:</I>
<UL>
<I>ptr-operator conversion-declarator<SUB>opt</SUB>
</I>
</UL>
</UL>

<P><INS>A declaration whose <I>declarator-id</I> has an
<I>unqualified-id</I> that is a <I>conversion-function-id</I>
declares a <I>conversion function</I>; its <I>declarator</I>
shall be a function declarator (9.3.4.6 [<A href="https://wg21.link/dcl.fct">dcl.fct</A>])
of the form</INS></P>

<UL>
<INS><I>ptr-declarator</I> <TT>(</TT> <I>parameter-declaration-clause</I> <TT>)</TT> <I>cv-qualifier-seq<SUB>opt</SUB></I></INS>
<UL>
<INS><I>ref-qualifier-seq<SUB>opt</SUB> noexcept-specifier<SUB>opt</SUB> attribute-specifier-seq<SUB>opt</SUB></I></INS>
</UL>
</UL>

<P><INS>where the <I>ptr-declarator</I> consists solely of
an <I>id-expression</I>, an
optional <I>attribute-specifier-seq</I>, and optional surrounding
parentheses, and the <I>id-expression</I> has one of the following
forms:</INS></P>

<UL>
<LI><P><INS>in a <I>member-declaration</I> that belongs
to the <I>member-specification</I> of a class or class
template but is not a friend declaration
(11.8.4 [<A href="https://wg21.link/class.friend">class.friend</A>]), the <I>id-expression</I>
is a <I>conversion-function-id</I>;</INS></P></LI>

<LI><P><INS>otherwise, the <I>id-expression</I> is a
<I>qualified-id</I> whose <I>unqualified-id</I> is a
<I>conversion-function-id</I>.</INS></P></LI>

</UL>

<P>
<INS>A conversion function</INS> shall have no parameters
and <INS>shall be a non-static member function of a class or
class template <TT>X</TT>; it</INS> specifies a conversion
from <TT>X</TT> to the type specified by
the <I>conversion-type-id</I>, interpreted as
a <I>type-id</I> (9.3.2 [<A href="https://wg21.link/dcl.name">dcl.name</A>]). <DEL>Such
functions are called <I>conversion functions</I>.</DEL>
</P>

<P>A <I>decl-specifier</I> in the <I>decl-specifier-seq</I> of
a conversion function (if any) shall <INS>not</INS>
be <DEL>neither</DEL>
a <I>defining-type-specifier</I> <DEL>nor
<TT>static</TT></DEL>. The type of the conversion function
<DEL>(9.3.4.6 [<A href="https://wg21.link/dcl.fct">dcl.fct</A>])</DEL> is
&#8220;<INS><TT>noexcept</TT><SUB><I>opt</I></SUB></INS>
function taking no parameter <INS><I>cv-qualifier-seq<SUB>opt</SUB>
ref-qualifier<SUB>opt</SUB></I></INS>
returning <I>conversion-type-id</I>&#8221;.</P>

<P>A conversion function is never used to convert a
(possibly cv-qualified) object to the (possibly
cv-qualified) same object type (or a reference to it), to a
(possibly cv-qualified) base class of that type (or a
reference to it), or
to <I>cv</I> <TT>void</TT>.<SUP>102</SUP> [<I>Example
1</I>:...</P>

</BLOCKQUOTE>

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