[C++ Patch] PR 68726 ("ice: tree check: expected tree_vec, have error_mark in comp_template_args_with_info, at cp/pt.c:7890")

Paolo Carlini paolo.carlini@oracle.com
Wed Feb 10 22:46:00 GMT 2016


Hi,

turns out, this small ICE on invalid is actually a regression, I can 
only reproduce it in trunk. Anyway, the ICE occurs immediately when, 
during error recovery, comp_template_args gets an error_mark_node as 
second argument. Tested x86_64-linux.

Thanks,
Paolo.

P.S. Second try: the first time my message was rejected as spam!?!

///////////


-------------- next part --------------
/cp
2016-02-10  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/68726
	* pt.c (lookup_template_class_1): Check tsubst return value for
	error_mark_node.

/testsuite
2016-02-10  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/68726
	* g++.dg/cpp0x/pr68726.C: New.
-------------- next part --------------
Index: cp/pt.c
===================================================================
--- cp/pt.c	(revision 233308)
+++ cp/pt.c	(working copy)
@@ -8547,6 +8547,8 @@ lookup_template_class_1 (tree d1, tree arglist, tr
 		    arglist, complain, NULL_TREE);
 	  --processing_template_decl;
 	  TREE_VEC_LENGTH (arglist)++;
+	  if (partial_inst_args == error_mark_node)
+	    return error_mark_node;
 	  use_partial_inst_tmpl =
 	    /*...and we must not be looking at the partial instantiation
 	     itself. */
Index: testsuite/g++.dg/cpp0x/pr68726.C
===================================================================
--- testsuite/g++.dg/cpp0x/pr68726.C	(revision 0)
+++ testsuite/g++.dg/cpp0x/pr68726.C	(working copy)
@@ -0,0 +1,7 @@
+// { dg-do compile { target c++11 } }
+
+template <typename> struct A {
+  template <typename, > struct __construct_helper;  // { dg-error "expected" }
+  template <typename... _Args>
+  using __has_construct typename __construct_helper<_Args...>::type;  // { dg-error "expected" }
+} struct : A<int> {  // { dg-error "expected" }


More information about the Gcc-patches mailing list