<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 508</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="508"></A><H4>508.
  
Non-constructed value-initialized objects
</H4>
<B>Section: </B>9.5&#160; [<A href="https://wg21.link/dcl.init">dcl.init</A>]
 &#160;&#160;&#160;

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

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

 <B>Date: </B>18 Mar 2005<BR>


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

<P>According to the definition of <I>value initialization</I>
(9.5 [<A href="https://wg21.link/dcl.init#5">dcl.init</A>] paragraph 5), non-union class types without
user-declared constructors are value-initialized by value-initializing
each of their members rather than by executing the (generated)
default constructor.  However, a number of other items in the
Standard are described in relationship to the execution of the
constructor:</P>

<UL>

<LI><P>11.4.7 [<A href="https://wg21.link/class.dtor#6">class.dtor</A>] paragraph 6: &#8220;Bases and
members are destroyed in the reverse order of the completion of their
constructor.&#8221;  If a given base or member is value-initialized without
running its constructor, is it destroyed?  (For that matter, paragraph
10 refers to &#8220;constructed&#8221; objects; is an object that is
value-initialized without invoking a constructor
&#8220;constructed?&#8221;)</P></LI>

<LI><P>14.3 [<A href="https://wg21.link/except.ctor#2">except.ctor</A>] paragraph 2: &#8220;An object that is
partially constructed or partially destroyed will have destructors
executed for all of its fully constructed subobjects, that is, for
subobjects for which the constructor has completed
execution...&#8221;</P></LI>

<LI><P>6.8.4 [<A href="https://wg21.link/basic.life#1">basic.life</A>] paragraph 1: The lifetime of an
object begins when &#8220;the constructor call has completed.&#8221;
(In the TC1 wording&#160;&#8212; &#8220;if <TT>T</TT> is a class type
with a non-trivial constructor (11.4.5 [<A href="https://wg21.link/class.ctor">class.ctor</A>]), the
constructor call has completed&#8221;&#160;&#8212; the lifetime of
some value-initialized objects never began; in the current wording
&#8212;&#160;&#8220;the constructor invoked to create the object is
non-trivial&#8221;&#160;&#8212; the lifetime begins before any of the
members are initialized.)</P></LI>

</UL>

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

<P>Add the indicated words to 9.5 [<A href="https://wg21.link/dcl.init#6">dcl.init</A>] paragraph 6:</P>

<BLOCKQUOTE>

A program that calls for default-initialization or
value-initialization of an entity of reference type is ill-formed. If
<TT>T</TT> is a cv-qualified type, the cv-unqualified version
of <TT>T</TT> is used for these definitions of zero-initialization,
default-initialization, and value-initialization. <INS>Even when
value-initialization of an object does not call that object's
constructor, the object is deemed to have been fully constructed once
its initialization is complete and thus subject to provisions of this
International Standard applying to &#8220;constructed&#8221; objects,
objects &#8220;for which the constructor has completed
execution,&#8221; etc.</INS>

</BLOCKQUOTE>

<P><B>Notes from April, 2006 meeting:</B></P>

<P>There was some concern about whether this wording covered (or
needed to cover) cases where an object is &#8220;partially
constructed.&#8221;  Another approach might be simply to define
value initialization to be &#8220;construction.&#8221;  Returned to
&#8220;drafting&#8221; status for further investigation.</P>

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

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

<BLOCKQUOTE>

<P>To <I>value-initialize</I> an object of type <TT>T</TT> means:</P>

<UL>
<LI><P>...</P></LI>

</UL>

<P><INS>An object that is value-initialized is deemed to be constructed
and thus subject to provisions of this International Standard applying
to &#8220;constructed&#8221; objects, objects &#8220;for which the
constructor has completed,&#8221; etc., even if no constructor is invoked
for the object's initialization.</INS></P>

</BLOCKQUOTE>

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