public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-7552] PR c++/96440: ICE-on-invalid-code error recovery.
@ 2022-03-08 23:35 Roger Sayle
0 siblings, 0 replies; only message in thread
From: Roger Sayle @ 2022-03-08 23:35 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:e52af9cac7fa7409c78c9f336dc1da57750c9766
commit r12-7552-ge52af9cac7fa7409c78c9f336dc1da57750c9766
Author: Roger Sayle <roger@nextmovesoftware.com>
Date: Tue Mar 8 23:33:46 2022 +0000
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.
Diff:
---
gcc/cp/decl.cc | 6 ++++--
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 7f80f9d4d7a..de41b4de5ed 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 00000000000..000caf3197d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr96440.C
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-excess-errors "" } */
+
+auto alignas a [[]] [[const]] ();
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-03-08 23:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-08 23:35 [gcc r12-7552] PR c++/96440: ICE-on-invalid-code error recovery Roger Sayle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).