This fixes an ICE on invalid code where one of the parameters was
error_mark_node and thus resetting its DECL_CONTEXT crashed.
gcc/cp/ChangeLog:
PR c++/99500
* parser.c (cp_parser_requirement_parameter_list): Handle
error_mark_node.
gcc/testsuite/ChangeLog:
PR c++/99500
* g++.dg/cpp2a/concepts-err3.C: New test.
if (parm == void_list_node || parm == explicit_void_list_node)
break;
tree decl = TREE_VALUE (parm);
- DECL_CONTEXT (decl) = NULL_TREE;
- CONSTRAINT_VAR_P (decl) = true;
+ if (decl != error_mark_node)
+ {
+ DECL_CONTEXT (decl) = NULL_TREE;
+ CONSTRAINT_VAR_P (decl) = true;
+ }
}
return parms;
--- /dev/null
+// PR c++/99500
+// { dg-do compile { target c++20 } }
+
+bool b = requires (bool a, int a) { requires true; }; // { dg-error "conflicting declaration" }