<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1507</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="1507"></A><H4>1507.
  
Value initialization with trivial inaccessible default constructor
</H4>
<B>Section: </B>9.5&#160; [<A href="https://wg21.link/dcl.init">dcl.init</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Johannes Schaub
 &#160;&#160;&#160;

 <B>Date: </B>2012-06-01<BR>


<P>[Moved to DR at the April, 2013 meeting.]</P>



<P>According to 9.5 [<A href="https://wg21.link/dcl.init#7">dcl.init</A>] paragraph 7, a trivial default
constructor is not used in value initialization, so the following
example would appear to be well-formed:</P>

<PRE>
  struct A { private: A() = default; };
  int main() { A(); }
</PRE>

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

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

<BLOCKQUOTE>

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

<UL>
<LI><P>if <TT>T</TT> is a (possibly cv-qualified) class type (
Clause 11 [<A href="https://wg21.link/class">class</A>]), the default
constructor <INS>(11.4.5 [<A href="https://wg21.link/class.ctor">class.ctor</A>])</INS> for <TT>T</TT> is called
(and the initialization is ill-formed if <TT>T</TT> has no <DEL>accessible
default constructor</DEL> <INS>default constructor or overload
resolution (12.2 [<A href="https://wg21.link/over.match">over.match</A>]) results in an ambiguity or
in a function that is deleted or inaccessible from the context of the
initialization</INS>);</P></LI>

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

</UL>

</BLOCKQUOTE>

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

<BLOCKQUOTE>

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

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

<LI><P>if <TT>T</TT> is a (possibly cv-qualified) non-union class type
without a user-provided or deleted default constructor, then the object is
zero-initialized and <INS>the semantic constraints for
default-initialization are checked</INS>, <INS>and</INS> if <TT>T</TT> has
a non-trivial default constructor, <INS>the object is</INS>
default-initialized;</P></LI>

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

</UL>

</BLOCKQUOTE>

</OL>

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