This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/61991] Destructors not always called for statically initialized thread_local objects
- From: "scovich at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 10 Jul 2015 13:53:03 +0000
- Subject: [Bug c++/61991] Destructors not always called for statically initialized thread_local objects
- Auto-submitted: auto-generated
- References: <bug-61991-4 at http dot gcc dot gnu dot org/bugzilla/>
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