decl.c (cp_finish_decl): Correct check for dynamic initialization of thread-local...
authorMark Mitchell <mark@codesourcery.com>
Tue, 1 Oct 2002 18:27:53 +0000 (18:27 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Tue, 1 Oct 2002 18:27:53 +0000 (18:27 +0000)
* 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

gcc/cp/ChangeLog
gcc/cp/decl.c

index e6ea3fe23064eba1df3850e4dba6093303ccb9bb..6d4031c425b1be4533b299cbac36d419019c420c 100644 (file)
@@ -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
index fb6c776e65fe2606796950ecd00a9e9a13512a2c..eec8bbb8baa51d5c2678a0bc3ec7c14fd97e1af5 100644 (file)
@@ -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: