<div class="gmail_quote">On Sat, May 19, 2012 at 6:43 PM, Jordy Rose <span dir="ltr"><<a href="mailto:jediknil@belkadan.com" target="_blank">jediknil@belkadan.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I am not a standardista, but this doesn't seem right to me. The target constructor finishes before the delegating constructor runs, and presumably the target constructor has to be able to initialize the entire object by itself. I don't see anything in the standard that says 'x' is zero-initialized by the default constructor on its own, the default constructor as a target, or the delegating constructor.<br>
</blockquote><div><br></div><div>[class.base.init]/7: The expression-list or braced-init-list in a mem-initializer is used to initialize the designated subobject (or, in the case of a delegating constructor, the complete class object) according to the initialization rules of [dcl.init] for direct-initialization.</div>
<div>[dcl.init]/10: An object whose initializer is an empty set of parentheses, i.e., (), shall be value-initialized.</div><div>[dcl.init]/7: To value-initialize an object of type T means: [...] if T is a (possibly cv-qualified) non-union class type without a user-provided constructor, then the object is zero-initialized [...]</div>
<div>[dcl.fct.def.default]/4: A member function is user-provided if it is user-declared and not explicitly defaulted or deleted on its first declaration.</div><div><br></div><div>Thus X() performs zero-initialization before calling the default constructor. Even when used in a delegating initialization.</div>
</div>