Hi,
a simple ICE on invalid: the problem manifests itself when, during error
recovery, var_defined_without_dynamic_init does
TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (var)) for a VAR_DECL which
has error_mark_node as TREE_TYPE.
It seems to me that a good place to avoid this is finish_id_expression
(a bit earlier), where we already use error_operand_p, by not calling at
all get_tls_wrapper_fn on such a decl.
Tested x86_64-linux.
Thanks,
Paolo.
/////////////////
/cp
2013-01-08 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/55801
* semantics.c (finish_id_expression): Don't call get_tls_wrapper_fn
on a decl with error_mark_node as TREE_TYPE.
/testsuite
2013-01-08 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/55801
* g++.dg/tls/thread_local-ice.C: New.
Index: cp/semantics.c
===================================================================
--- cp/semantics.c (revision 195008)
+++ cp/semantics.c (working copy)
@@ -3,7 +3,7 @@
building RTL. These routines are used both during actual parsing
and during the instantiation of template functions.
- Copyright (C) 1998-2012 Free Software Foundation, Inc.
+ Copyright (C) 1998-2013 Free Software Foundation, Inc.
Written by Mark Mitchell (mmitch...@usa.net) based on code found
formerly in parse.y and pt.c.
@@ -3290,8 +3290,9 @@ finish_id_expression (tree id_expression,
}
tree wrap;
- if (TREE_CODE (decl) == VAR_DECL
- && !cp_unevaluated_operand
+ if (! error_operand_p (decl)
+ && TREE_CODE (decl) == VAR_DECL
+ && ! cp_unevaluated_operand
&& DECL_THREAD_LOCAL_P (decl)
&& (wrap = get_tls_wrapper_fn (decl)))
{
Index: testsuite/g++.dg/tls/thread_local-ice.C
===================================================================
--- testsuite/g++.dg/tls/thread_local-ice.C (revision 0)
+++ testsuite/g++.dg/tls/thread_local-ice.C (working copy)
@@ -0,0 +1,6 @@
+// PR c++/55801
+// { dg-options "-std=c++11" }
+// { dg-require-effective-target tls }
+
+class C;
+thread_local C O, O2 = O; // { dg-error "incomplete" }