<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1219</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="1219"></A><H4>1219.
  
Non-static data member initializers in constant expressions
</H4>
<B>Section: </B>6.9&#160; [<A href="https://wg21.link/basic.types">basic.types</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Jens Maurer
 &#160;&#160;&#160;

 <B>Date: </B>2010-11-13<BR>


<P>[Voted into the WP at the March, 2011 meeting as part of paper N3262.]</P>

<P>The current treatment of constexpr constructors and constant expressions
does not deal with the initializers for non-static data members, which
should also be required to be constant expressions.</P>

<P><B>Proposed resolution (November, 2010) [SUPERSEDED]:</B></P>

<OL>
<LI><P>Change 6.10.3.2 [<A href="https://wg21.link/basic.start.static#2">basic.start.static</A>] paragraph 2 as follows:</P></LI>

<UL><LI><P>if an object with static or thread storage duration is
initialized by a constructor call, if the constructor is a
<TT>constexpr</TT> constructor, if all constructor arguments are
constant expressions (including conversions), and if, after function
invocation substitution (9.2.6 [<A href="https://wg21.link/dcl.constexpr">dcl.constexpr</A>]), every constructor call
and full-expression in the <I>mem-initializer</I>s <INS>and in the
<I>brace-or-equal-initializer</I>s for non-static data members</INS>
is a constant expression </P></LI></UL>

<LI><P>Change 6.9 [<A href="https://wg21.link/basic.types#10">basic.types</A>] paragraph 10 as follows (wording
assumes the proposed resolution of <A HREF="981.html">issue 981</A>)</P></LI>

<BLOCKQUOTE>

<P>A type is a <I>literal type</I> if it is:</P>

<UL>
<LI><P>a scalar type; or</P></LI>

<LI><P>a class type (Clause 11 [<A href="https://wg21.link/class">class</A>]) that
<INS>has all of the following properties:</INS>
</P></LI>

<UL>
<LI><P>
<INS>it</INS> has a trivial destructor,</P></LI>

<LI><P><INS>every constructor call and full-expression in the
<I>brace-or-equal-initializer</I>s for non-static data members (if
any) is a constant expression (7.7 [<A href="https://wg21.link/expr.const">expr.const</A>]),</INS></P></LI>

<LI><P>
<INS>it</INS> is an aggregate type (9.5.2 [<A href="https://wg21.link/dcl.init.aggr">dcl.init.aggr</A>]) or
has at least one <TT>constexpr</TT> constructor or constructor
template that is not a copy or move constructor, and</P></LI>

<LI><P>
<INS>it</INS> has all non-static data members and base
classes of literal types; or</P></LI>

</UL>

<LI><P>an array of literal type.</P></LI>

</UL>

</BLOCKQUOTE>

</OL>

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