[Bug c++/72768] Potential bug about the order of destructors of static objects and atexit() callbacks in C++?

lh_mouse at 126 dot com gcc-bugzilla@gcc.gnu.org
Tue Aug 2 01:46:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72768

--- Comment #2 from lh_mouse <lh_mouse at 126 dot com> ---
(In reply to Jonathan Wakely from comment #1)
> Arguably the object is not completely initialized until the principal
> constructor returns.

I doubt it. If an exception is thrown inside the principal ctor which delegates
to another one, the dtor is called. It doesn't make sense to call a dtor on an
object that has not been completely initialized.
(A public target ctor and a private one have different semantical purposes, but
it is a different story.)


More information about the Gcc-bugs mailing list