In the n3690 C++ standard in section 3.8.1 there is this text:
The lifetime of an object of type T begins when:
— storage with the proper alignment and size for type T is obtained, and
— if the object has non-trivial initialization, its initialization is complete.
Assume that there is a user defined constructor.
What does the last sentence mean? Is it when the initializer list has finished initializing or is it when constructor body has finished running? Or does the last sentence mean something else?
This. An object that throws during construction is not guaranteed to have its invariants established, hence its lifetime doesn't start. A consequence of this is that the destructor will not get called:
live demo. Note how "inside destructor" does not appear in the output.
12.6.2, [class.base.init], item 6, lists the steps of initialization, and this is the final one:
So once the body has executed, initialization is complete.
There is a note:
It means when the trivial constructor will finish its execution.