re PR c++/55800 (Link failure with thread_local in unnamed namespace)

PR c++/55800
	* decl2.c (get_tls_init_fn): Copy DECL_EXTERNAL from the variable.

From-SVN: r207360
This commit is contained in:
Jason Merrill 2014-01-31 11:25:55 -05:00 committed by Jason Merrill
parent f1f82a37ae
commit 99a82a1e16
3 changed files with 17 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2014-01-31 Jason Merrill <jason@redhat.com>
PR c++/55800
* decl2.c (get_tls_init_fn): Copy DECL_EXTERNAL from the variable.
2014-01-31 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/59082

View File

@ -2949,7 +2949,7 @@ get_tls_init_fn (tree var)
TREE_PUBLIC (fn) = TREE_PUBLIC (var);
DECL_ARTIFICIAL (fn) = true;
DECL_COMDAT (fn) = DECL_COMDAT (var);
DECL_EXTERNAL (fn) = true;
DECL_EXTERNAL (fn) = DECL_EXTERNAL (var);
if (DECL_ONE_ONLY (var))
make_decl_one_only (fn, cxx_comdat_group (fn));
if (TREE_PUBLIC (var))

View File

@ -0,0 +1,11 @@
// PR c++/55800
// { dg-options "-std=c++11" }
// { dg-require-alias "" }
// { dg-final { scan-assembler "_ZTH12foo_instance" { target tls_native } } }
struct foo
{
foo();
};
thread_local foo foo_instance;