[cfe-commits] r157138 - in /cfe/trunk: lib/CodeGen/CGExprCXX.cpp test/CodeGenCXX/cxx0x-delegating-ctors.cpp
Richard Smith
richard at metafoo.co.uk
Sat May 19 21:20:48 PDT 2012
On Sat, May 19, 2012 at 6:43 PM, Jordy Rose <jediknil at belkadan.com> wrote:
> 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.
>
[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.
[dcl.init]/10: An object whose initializer is an empty set of parentheses,
i.e., (), shall be value-initialized.
[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 [...]
[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.
Thus X() performs zero-initialization before calling the default
constructor. Even when used in a delegating initialization.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120519/b8d12dbe/attachment.html>
More information about the cfe-commits
mailing list