re PR c++/58672 ([c++11] ICE with thread_local and variable of broken class)

PR c++/58672
	* decl2.c (handle_tls_init): Handle null init fn.

From-SVN: r207363
This commit is contained in:
Jason Merrill 2014-01-31 12:30:03 -05:00 committed by Jason Merrill
parent 99a82a1e16
commit 6962711f95
3 changed files with 16 additions and 0 deletions

View File

@ -1,5 +1,8 @@
2014-01-31 Jason Merrill <jason@redhat.com>
PR c++/58672
* decl2.c (handle_tls_init): Handle null init fn.
PR c++/55800
* decl2.c (get_tls_init_fn): Copy DECL_EXTERNAL from the variable.

View File

@ -4036,6 +4036,8 @@ handle_tls_init (void)
if (TREE_PUBLIC (var))
{
tree single_init_fn = get_tls_init_fn (var);
if (single_init_fn == NULL_TREE)
continue;
cgraph_node *alias
= cgraph_same_body_alias (cgraph_get_create_node (fn),
single_init_fn, fn);

View File

@ -0,0 +1,11 @@
// PR c++/58672
// { dg-options "-std=c++11" }
// { dg-require-effective-target tls }
struct A
{
A(int);
i; // { dg-error "" }
};
thread_local A a(0);