diff mbox

[C++] PR 58614

Message ID 54A16B0A.2000200@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Dec. 29, 2014, 2:54 p.m. UTC
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.carlini@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.carlini@oracle.com>

	PR c++/58614
	* g++.dg/cpp0x/auto44.C: New.

Comments

Paolo Carlini Jan. 15, 2015, 9:58 a.m. UTC | #1
Hi,

pinging this patchlet...

     https://gcc.gnu.org/ml/gcc-patches/2014-12/msg01926.html

On 12/29/2014 03:54 PM, Paolo Carlini wrote:
> 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.
Jason Merrill Jan. 16, 2015, 4:09 a.m. UTC | #2
OK.

Jason
diff mbox

Patch

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" }
+}