Hi,
in this ICE on invalid, we crash during error recovery when
maybe_adjust_types_for_deduction gets an elt which has TREE_TYPE (elt)
== error_mark_node. I think we can simply check for that and return
unify_invalid. Tested x86_64-linux.
Thanks,
Paolo.
/////////////////////////
/cp
2014-12-29 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/58614
* pt.c (unify): When BRACE_ENCLOSED_INITIALIZER_P (arg), handle
TREE_TYPE (elt) == error_mark_node.
/testsuite
2014-12-29 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/58614
* g++.dg/cpp0x/auto44.C: New.
Index: cp/pt.c
===================================================================
--- cp/pt.c (revision 219098)
+++ cp/pt.c (working copy)
@@ -17857,6 +17857,8 @@ unify (tree tparms, tree targs, tree parm, tree ar
if (!BRACE_ENCLOSED_INITIALIZER_P (elt))
{
tree type = TREE_TYPE (elt);
+ if (type == error_mark_node)
+ return unify_invalid (explain_p);
/* It should only be possible to get here for a call. */
gcc_assert (elt_strict & UNIFY_ALLOW_OUTER_LEVEL);
elt_strict |= maybe_adjust_types_for_deduction
Index: testsuite/g++.dg/cpp0x/auto44.C
===================================================================
--- testsuite/g++.dg/cpp0x/auto44.C (revision 0)
+++ testsuite/g++.dg/cpp0x/auto44.C (working copy)
@@ -0,0 +1,10 @@
+// PR c++/58614
+// { dg-do compile { target c++11 } }
+
+#include <initializer_list>
+
+void foo()
+{
+ i; // { dg-error "not declared" }
+ auto j = { i }; // { dg-error "unable to deduce" }
+}