diff options
author | Roger Sayle <roger@nextmovesoftware.com> | 2022-03-08 23:33:46 +0000 |
---|---|---|
committer | Roger Sayle <roger@nextmovesoftware.com> | 2022-03-08 23:33:46 +0000 |
commit | e52af9cac7fa7409c78c9f336dc1da57750c9766 (patch) | |
tree | 56d5925c66c05c2491deaa2a98dc66a9ac43f9e3 /gcc | |
parent | 48777d982add74cef14ec6704a622fce4d4a2609 (diff) | |
download | gcc-e52af9cac7fa7409c78c9f336dc1da57750c9766.zip gcc-e52af9cac7fa7409c78c9f336dc1da57750c9766.tar.gz gcc-e52af9cac7fa7409c78c9f336dc1da57750c9766.tar.bz2 |
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/decl.cc | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/pr96440.C | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index 7f80f9d..de41b4d 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -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); diff --git a/gcc/testsuite/g++.dg/cpp0x/pr96440.C b/gcc/testsuite/g++.dg/cpp0x/pr96440.C new file mode 100644 index 0000000..000caf3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr96440.C @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-excess-errors "" } */ + +auto alignas a [[]] [[const]] (); |