On 3/7/22 08:33, Roger Sayle wrote:
This patch fixes PR c++/96437 which is an ICE-on-invalid-code regression
affecting mainline.
This patch has been tested on x86_64-pc-linux-gnu, enabling languages
c and c++, with make bootstrap and make -k check with no new failures.
Ok for mainline?
2022-03-07 Roger Sayle <ro...@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/pr96437.C: New test case.
+ if (TREE_VALUE (new_parm) != error_mark_node)
+ DECL_VIRTUAL_P (TREE_VALUE (new_parm)) = true;
Hmm, I wonder about returning early if there was an error, but this is
fine as is.
+/* { dg-options "-O2" } */
This also seems unneeded for this test.
Also, please put tests in a subdirectory of g++.dg, not the top
directory. This one might go in cpp2a/ since it's a C++20 feature.
OK with those adjustments.
Jason