diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-10-01 18:27:53 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-10-01 18:27:53 +0000 |
commit | 77b5d7545ad5292f969703284cdfe2e08d66667a (patch) | |
tree | 504f3e59d53157b37f89bbe736d21ce4580476ee /gcc/cp/decl.c | |
parent | 4798e4c4c650b195cf8d375e78dfaaa7ad382493 (diff) | |
download | gcc-77b5d7545ad5292f969703284cdfe2e08d66667a.tar.gz |
* decl.c (cp_finish_decl): Correct check for dynamic
initialization of thread-local storage.
* g++.dg/tls/init-2.C: Tweak error messages.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@57696 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index fb6c776e65f..eec8bbb8baa 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: |