<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 892</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="892"></A><H4>892.
  
Missing requirements for constexpr constructors
</H4>
<B>Section: </B>9.2.6&#160; [<A href="https://wg21.link/dcl.constexpr">dcl.constexpr</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Alisdair Meredith
 &#160;&#160;&#160;

 <B>Date: </B>8 May, 2009<BR>


<P>[Voted into WP at August, 2010 meeting.]</P>

<P>The rules for constexpr constructors are missing some necessary
requirements.  In particular, there is no requirement that a
<I>brace-or-equal-initializer</I> for a non-static data member be
a constant expression, and the requirement for constexpr constructors
for initializing non-static data members applies only to members
named in a <I>mem-initializer</I>, allowing a non-constexpr default
constructor to be invoked.</P>

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

<P>Change 9.2.6 [<A href="https://wg21.link/dcl.constexpr#4">dcl.constexpr</A>] paragraph 4 as follows:</P>

<BLOCKQUOTE>

<P>The definition of a constexpr constructor shall satisfy the
following constraints:</P>

<UL>
<LI><P>each of its parameter types shall be a literal type or a
reference to a literal type</P></LI>

<LI><P>its <I>function-body</I> shall not be a
<I>function-try-block</I>
</P></LI>

<LI><P>the <I>compound-statement</I> of its <I>function-body</I> shall
be empty</P></LI>

<LI><P>every non-static data member and base class sub-object shall be
initialized (11.9.3 [<A href="https://wg21.link/class.base.init">class.base.init</A>])</P></LI>

<LI><P>every constructor involved in initializing non-static data
members and base class sub-objects <DEL>invoked by a
<I>mem-initializer</I></DEL> shall be a constexpr
constructor<DEL>.</DEL>
</P></LI>

<LI><P>every constructor argument and full-expression in a
<I>mem-initializer</I> shall be a potential constant
expression</P></LI>

<LI><P><INS>every <I>assignment-expression</I> that is an
<I>initializer-clause</I> appearing directly or indirectly within a
<I>brace-or-equal-initializer</I> for a non-static data member that is
not named by a <I>mem-initializer-id</I> shall be a constant
expression</INS></P></LI>

<LI><P>every implicit conversion used in converting a constructor
argument to the corresponding parameter type and converting a
full-expression to the corresponding member type shall be one of those
allowed in a constant expression.</P></LI>

</UL>

</BLOCKQUOTE>

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