This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/72768] Potential bug about the order of destructors of static objects and atexit() callbacks in C++?
- From: "lh_mouse at 126 dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 02 Aug 2016 04:13:08 +0000
- Subject: [Bug c++/72768] Potential bug about the order of destructors of static objects and atexit() callbacks in C++?
- Auto-submitted: auto-generated
- References: <bug-72768-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72768
--- Comment #3 from lh_mouse <lh_mouse at 126 dot com> ---
> 15.2 Constructors and destructors [except.ctor]
> 3 For an object of class type of any storage duration whose initialization or destruction is terminated by an
> exception, the destructor is invoked for each of the object’s fully constructed subobjects, that is, for each
> subobject for which the principal constructor (12.6.2) has completed execution and the destructor has not
> yet begun execution, except that in the case of destruction, the variant members of a union-like class are not
> destroyed. ...
Strangely enough, the standard says 'fully constructed' instead of 'completely
initialized' here. I tend to consider it a symbol indicating that the committee
think the two phrases are distinct from each other. From my point of view, the
object is 'completely initialized' once a (delegated or non-delegated,
including principle) ctor returns - if an exception is thrown, the dtor shall
be called -, despite the principal ctor in progress. The antonym of 'completely
initialized' should be 'partially initialized', being in a state when the ctor
of a subobject throws an exception, which is not the case here.