This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: thread-local storage: c99 and c++98 edits
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Richard Henderson <rth at redhat dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 23 May 2002 12:01:00 -0700
- Subject: Re: thread-local storage: c99 and c++98 edits
- References: <20020522214304.A26231@redhat.com>
+not be applied to block-scoped automatic or class-scoped member variables.
The C++ things you're talking about are "non-static data members".
+In C++, a thread-local variable may not be initialized at runtime,
+that is, either by a static constructor or a non-constant expression.
In C++, if an initializer is present for a thread-local variable, it must
be a constant-expression, as defined in 5.19.2 of the ANSI/ISO C++ standard.
(This is the paragraph that defines what it means to be a
constant-expression for the purpose of non-local static object
initialization.)
+@quotation
+An object of thread storage duration shall not require a destructor.
+@end quotation
The type of an object with thread storage duration shall not have a
non-trivial destructor, nor shall it be an array type whose elements
(directly or indirectly) have non-trivial destructors.
(This is necessary to allow *any* structure type to be used in TLS.
All structure types have destructors; it's just that some of them are
trivial.)
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com