<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 714</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="714"></A><H4>714.
  
Static const data members and <I>braced-init-list</I>s
</H4>
<B>Section: </B>11.4.9.3&#160; [<A href="https://wg21.link/class.static.data">class.static.data</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Steve Adamczyk
 &#160;&#160;&#160;

 <B>Date: </B>15 September, 2008<BR>


<P>[Voted into WP at July, 2009 meeting.]</P>

<P>The recent changes in the handling of initialization have not
touched the requirement that the in-class initializer for a const
static data member must be of the form
<TT>=</TT>&#160;<I>assignment-expression</I> and not a
<I>braced-init-list</I>.  It would be more consistent and
general to allow the braced form as well.</P>

<P><B>Proposed resolution (March, 2009):</B></P>

<OL>
<LI><P>Change 7.7 [<A href="https://wg21.link/expr.const#3">expr.const</A>] paragraph 3 as follows:</P></LI>

<BLOCKQUOTE>

...as enumerator initializers (9.8.1 [<A href="https://wg21.link/dcl.enum">dcl.enum</A>]), <DEL>as static
member initializers (11.4.9.3 [<A href="https://wg21.link/class.static.data">class.static.data</A>]),</DEL> and as integral or
enumeration non-type template arguments (13.6 [<A href="https://wg21.link/temp.type">temp.type</A>]).

</BLOCKQUOTE>

<LI><P>Change 11.4.9.3 [<A href="https://wg21.link/class.static.data#3">class.static.data</A>] paragraph 3 as follows:</P></LI>

<BLOCKQUOTE>

If a <TT>static</TT> data member is of <TT>const</TT> effective
literal type, its declaration in the class definition can specify a
<I>brace-or-equal-initializer</I> <DEL>with an</DEL> <INS>in which every</INS>
<I>initializer-clause</I> that is an <INS><I>assignment-expression</I>
is a</INS> <DEL>integral</DEL> constant expression.  A <TT>static</TT> data member
of effective literal type can be declared in the class definition with
the <TT>constexpr</TT> specifier; if so, its declaration shall specify
a <I>brace-or-equal-initializer</I> <DEL>with an</DEL> <INS>in which every</INS>
<I>initializer-clause</I> that is an <INS><I>assignment-expression</I>
is a</INS> <DEL>integral</DEL> constant expression.  <INS>[<I>Note:</I></INS> In
both these cases, the member may appear in <DEL>integral</DEL> constant
expressions. <INS>&#8212;<I>end note</I>]</INS> The member shall still be
defined in a namespace scope if it is used in the program and the
namespace scope definition shall not contain an initializer.

</BLOCKQUOTE>

</OL>

<P><I>[Drafting note: this change also corrects an editorial error
resulting from overlapping changes that inadvertently retained the
original restriction that only members of integral type could be
initialized inside the class definition.]</I></P>

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