<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 2430</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="2430"></A><H4>2430.
  
Completeness of return and parameter types of member functions
</H4>
<B>Section: </B>11.4&#160; [<A href="https://wg21.link/class.mem">class.mem</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Krystian Stasiowski
 &#160;&#160;&#160;

 <B>Date: </B>2019-08-23<BR>


<P>[Adopted as a DR at the November, 2019 meeting.]</P>

<P>According to 11.4 [<A href="https://wg21.link/class.mem#7">class.mem</A>] paragraph 7,</P>

<BLOCKQUOTE>

A class is considered a completely-defined object type
(6.9 [<A href="https://wg21.link/basic.types">basic.types</A>]) (or complete type) at the closing
} of the <I>class-specifier</I>. The class is regarded as
complete within its complete-class contexts; otherwise it is
regarded as incomplete within its own
class <I>member-specification</I>.

</BLOCKQUOTE>

<P>The complete-class contexts (paragraph 6) include the body
of a member function but not its return and parameter types.
Thus it appears that an example like the following is
ill-formed:</P>

<PRE>
  struct S {
    S f(S s) { return s; }
  };
</PRE>

<P>because of 9.6.1 [<A href="https://wg21.link/dcl.fct.def.general#2">dcl.fct.def.general</A>] paragraph 2</P>

<BLOCKQUOTE>

The type of a parameter or the return type for a function
definition shall not be an incomplete or abstract (possibly
cv-qualified) class type in the context of the function
definition unless the function is deleted
(9.6.3 [<A href="https://wg21.link/dcl.fct.def.delete">dcl.fct.def.delete</A>]).

</BLOCKQUOTE>

<P>The words &#8220;in the context of the function
definition&#8221; were added by the resolution of
<A HREF="1824.html">issue 1824</A> to address this
problem, but &#8220;context&#8221; is most naturally
read as referring to the lexical context where the
definition appears rather than within its body.</P>

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

<P>Change 9.6.1 [<A href="https://wg21.link/dcl.fct.def.general#2">dcl.fct.def.general</A>] paragraph 2 as follows:</P>

<BLOCKQUOTE>

...The type of a parameter or the return type for a function
definition shall not be <DEL>an incomplete or abstract
(possibly cv-qualified) class type in the context of the
function definition</DEL> <INS>a (possibly cv-qualified)
class type that is incomplete or abstract within the
function body</INS> unless the function is deleted
(9.6.3 [<A href="https://wg21.link/dcl.fct.def.delete">dcl.fct.def.delete</A>]).

</BLOCKQUOTE>

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