c++: constrained lambda error-recovery [PR108972]

Better not to ICE after various valid errors.

	PR c++/108972

gcc/cp/ChangeLog:

	* lambda.cc (compare_lambda_template_head): Check more
	for error_mark_node.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/concepts-lambda3.C: Run at lower std levels,
	but expect errors.
This commit is contained in:
Jason Merrill 2023-03-09 17:01:48 -05:00
parent 4d0baeae31
commit a915c29a7d
2 changed files with 6 additions and 2 deletions

View file

@ -1537,6 +1537,8 @@ compare_lambda_template_head (tree tmpl_a, tree tmpl_b)
if (parm_a == error_mark_node)
return false;
parm_a = TREE_VALUE (parm_a);
if (parm_a == error_mark_node)
return false;
if (DECL_VIRTUAL_P (parm_a))
parm_a = NULL_TREE;
}
@ -1548,6 +1550,8 @@ compare_lambda_template_head (tree tmpl_a, tree tmpl_b)
if (parm_b == error_mark_node)
return false;
parm_b = TREE_VALUE (parm_b);
if (parm_b == error_mark_node)
return false;
if (DECL_VIRTUAL_P (parm_b))
parm_b = NULL_TREE;
}

View file

@ -1,4 +1,5 @@
// { dg-do run { target c++20 } }
// { dg-do run }
// { dg-excess-errors "" { target { ! concepts } } } (PR108972)
template<typename T>
concept C1 = __is_same_as(T, int)
@ -61,4 +62,3 @@ int main(int, char**)
return 0;
}