aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2002-10-01 18:27:53 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2002-10-01 18:27:53 +0000
commitb4c20e524ce008387c6efe06d10fbd4a488d8654 (patch)
tree504f3e59d53157b37f89bbe736d21ce4580476ee /gcc
parent871e97f72002d01c3a98f7e198f5dbbcd9157b09 (diff)
downloadgcc-b4c20e524ce008387c6efe06d10fbd4a488d8654.zip
gcc-b4c20e524ce008387c6efe06d10fbd4a488d8654.tar.gz
gcc-b4c20e524ce008387c6efe06d10fbd4a488d8654.tar.bz2
decl.c (cp_finish_decl): Correct check for dynamic initialization of thread-local storage.
* decl.c (cp_finish_decl): Correct check for dynamic initialization of thread-local storage. * g++.dg/tls/init-2.C: Tweak error messages. From-SVN: r57696
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl.c7
2 files changed, 12 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e6ea3fe..6d4031c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2002-10-01 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (cp_finish_decl): Correct check for dynamic
+ initialization of thread-local storage.
+
2002-09-30 Nathan Sidwell <nathan@codesourcery.com>
* tree.c (really_overloaded_fn): TEMPLATE_ID_EXPRs are also
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index fb6c776..eec8bbb 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -8218,6 +8218,13 @@ cp_finish_decl (decl, init, asmspec_tree, flags)
&& (!DECL_EXTERNAL (decl) || init))
{
init = check_initializer (decl, init);
+ /* Thread-local storage cannot be dynamically initialized. */
+ if (DECL_THREAD_LOCAL (decl) && init)
+ {
+ error ("`%D' is thread-local and so cannot be dynamically "
+ "initialized", decl);
+ init = NULL_TREE;
+ }
/* If DECL has an array type without a specific bound, deduce the
array size from the initializer. Note that this must be done
after check_initializer is called because of cases like this: