This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]