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++/61991] Destructors not always called for statically initialized thread_local objects


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

--- Comment #1 from Ryan Johnson <scovich at gmail dot com> ---
C++14 (N3652 [1]) specifically alters the Standard to state that a thread_local
object with static or constexpr initialization may have a non-trivial
destructor (implying that such a destructor should actually run):

> Variables with static storage duration (3.7.1) or thread storage duration
> (3.7.2) shall be zero-initialized (8.5) before any other initialization takes
> place. A constant initializer for an object o is an expression that is a
> constant expression, except that it may also invoke constexpr constructors for
> o and its subobjects even if those objects are of non-literal class types
> [ Note: such a class may have a non-trivial destructor ].

[1] https://isocpp.org/files/papers/N3652.html


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