public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-7550] PR c++/96437: ICE-on-invalid-code error recovery.
@ 2022-03-08 23:25 Roger Sayle
0 siblings, 0 replies; only message in thread
From: Roger Sayle @ 2022-03-08 23:25 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:3093f8a18e7a9c5a9bba976d58a2f91033e7f35a
commit r12-7550-g3093f8a18e7a9c5a9bba976d58a2f91033e7f35a
Author: Roger Sayle <roger@nextmovesoftware.com>
Date: Tue Mar 8 23:23:19 2022 +0000
PR c++/96437: ICE-on-invalid-code error recovery.
This patch fixes PR c++/96437 which is an ICE-on-invalid-code regression
affecting mainline.
2022-03-08 Roger Sayle <roger@nextmovesoftware.com>
gcc/cp/ChangeLog
PR c++/96437
* parser.cc (synthesize_implicit_template_parm): Check that
TREE_VALUE (new_parm) isn't error_mark_node before setting its
DECL_VIRTUAL_P.
gcc/testsuite/ChangeLog
PR c++/96437
* g++.dg/cpp2a/pr96437.C: New test case.
Diff:
---
gcc/cp/parser.cc | 3 ++-
gcc/testsuite/g++.dg/cpp2a/pr96437.C | 4 ++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index dc2d39a8751..9153c74f069 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -48218,7 +48218,8 @@ synthesize_implicit_template_parm (cp_parser *parser, tree constr)
function template is equivalent to an explicit template.
Note that DECL_ARTIFICIAL is used elsewhere for template parameters. */
- DECL_VIRTUAL_P (TREE_VALUE (new_parm)) = true;
+ if (TREE_VALUE (new_parm) != error_mark_node)
+ DECL_VIRTUAL_P (TREE_VALUE (new_parm)) = true;
// Chain the new parameter to the list of implicit parameters.
if (parser->implicit_template_parms)
diff --git a/gcc/testsuite/g++.dg/cpp2a/pr96437.C b/gcc/testsuite/g++.dg/cpp2a/pr96437.C
new file mode 100644
index 00000000000..79d481e7002
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/pr96437.C
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-excess-errors "" } */
+
+template <()> void A(auto){}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-03-08 23:25 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:25 [gcc r12-7550] PR c++/96437: 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).