PR c++/96440: ICE-on-invalid-code error recovery.
This patch fixes PR c++/96440 which is an ICE-on-invalid-code regression affecting mainline. 2022-03-08 Roger Sayle <roger@nextmovesoftware.com> gcc/cp/ChangeLog PR c++/96440 * decl.cc (start_decl): Defend against prefix_attributes being error_mark_node. gcc/testsuite/ChangeLog PR c++/96440 * g++.dg/cpp0x/pr96440.C: New test case.
This commit is contained in:
parent
48777d982a
commit
e52af9cac7
2 changed files with 8 additions and 2 deletions
|
@ -5483,13 +5483,15 @@ start_decl (const cp_declarator *declarator,
|
|||
|
||||
*pushed_scope_p = NULL_TREE;
|
||||
|
||||
attributes = chainon (attributes, prefix_attributes);
|
||||
if (prefix_attributes != error_mark_node)
|
||||
attributes = chainon (attributes, prefix_attributes);
|
||||
|
||||
decl = grokdeclarator (declarator, declspecs, NORMAL, initialized,
|
||||
&attributes);
|
||||
|
||||
if (decl == NULL_TREE || VOID_TYPE_P (decl)
|
||||
|| decl == error_mark_node)
|
||||
|| decl == error_mark_node
|
||||
|| prefix_attributes == error_mark_node)
|
||||
return error_mark_node;
|
||||
|
||||
context = CP_DECL_CONTEXT (decl);
|
||||
|
|
4
gcc/testsuite/g++.dg/cpp0x/pr96440.C
Normal file
4
gcc/testsuite/g++.dg/cpp0x/pr96440.C
Normal file
|
@ -0,0 +1,4 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-excess-errors "" } */
|
||||
|
||||
auto alignas a [[]] [[const]] ();
|
Loading…
Add table
Reference in a new issue