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

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

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

 <B>Date: </B>12 Aug 2007<BR>


<P>[Voted into the WP at the September, 2008 meeting.]</P>



<P>The current wording of 9.2.6 [<A href="https://wg21.link/dcl.constexpr#7">dcl.constexpr</A>] paragraph 7
seems not quite correct.  It reads,</P>

<BLOCKQUOTE>

A <TT>constexpr</TT> specifier used in an object declaration declares
the object as <TT>const</TT>. Such an object shall be initialized, and
every expression that appears in its initializer (9.5 [<A href="https://wg21.link/dcl.init">dcl.init</A>]) shall be a constant expression.

</BLOCKQUOTE>

<P>The phrase &#8220;every expression&#8221; is intended to cover
multiple arguments to a constexpr constructor and multiple expressions
in an aggregate initializer.  However, it could be read (incorrectly)
as saying that non-constant expressions cannot appear as subexpressions
in such initializers, even in places where they do not render the
full-expression non-constant (i.e., as unevaluated operands and in the
unselected branches of <TT>&amp;&amp;</TT>, <TT>||</TT>, and
<TT>?:</TT>).  Perhaps this problem could be remedied by replacing
&#8220;every expression&#8221; with &#8220;every
full-expression?&#8221;</P>

<P><B>Proposed resolution (June, 2008):</B></P>

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

<BLOCKQUOTE>

A <TT>constexpr</TT> specifier used in an object declaration declares
the object as <TT>const</TT>. Such an object shall be <DEL>initialized,
and every expression that appears in its initializer (8.5)</DEL>
<INS>initialized. If it is initialized by a constructor call, the
constructor shall be a constexpr constructor and every argument to the
constructor shall be a constant expression. Otherwise, every
full-expression that appears in its initializer</INS> shall be a
constant expression.  Every implicit conversion used...

</BLOCKQUOTE>

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