A colleague hit an ICE when build_pointer_plus exploded. tsubsting the pointer operand produced error_mark_node, and b_p_p is unprepared for that.

pushed to trunk

nathan
--
Nathan Sidwell
2020-04-21  Nathan Sidwell  <nat...@acm.org>

	* pt.c (tsubst_copy_and_build) [POINTER_PLUS_EXPR]: Check for
	error_mark_node.

diff --git i/gcc/cp/pt.c w/gcc/cp/pt.c
index cd6392aca22..6f74c278c23 100644
--- i/gcc/cp/pt.c
+++ w/gcc/cp/pt.c
@@ -19409,7 +19409,11 @@ tsubst_copy_and_build (tree t,
     case POINTER_PLUS_EXPR:
       {
 	tree op0 = RECUR (TREE_OPERAND (t, 0));
+	if (op0 == error_mark_node)
+	  RETURN (error_mark_node);
 	tree op1 = RECUR (TREE_OPERAND (t, 1));
+	if (op1 == error_mark_node)
+	  RETURN (error_mark_node);
 	RETURN (fold_build_pointer_plus (op0, op1));
       }
 

Reply via email to