diff options
author | Marek Polacek <polacek@redhat.com> | 2022-04-28 13:21:41 -0400 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2022-05-25 16:13:45 -0400 |
commit | da2c56ee601ac696a76e469e33c88313428c5c5a (patch) | |
tree | 4d6279b55c6c7652e918d41ea47843cebc76710b /gcc/cp/cp-tree.h | |
parent | 34970d08c6297e12f3f9117b6ac19fb2de522e24 (diff) | |
download | gcc-da2c56ee601ac696a76e469e33c88313428c5c5a.zip gcc-da2c56ee601ac696a76e469e33c88313428c5c5a.tar.gz gcc-da2c56ee601ac696a76e469e33c88313428c5c5a.tar.bz2 |
c++: fix ICE on invalid attributes [PR96637]
When chaining attributes, attr_chainon should be used rather than plain
chainon, so that we don't end up with a TREE_LIST where one of the elements
is error_mark_node, which causes problems. parser.cc has already been
fixed to use attr_chainon, but decl.cc has not. Until now.
PR c++/96637
gcc/cp/ChangeLog:
* cp-tree.h (attr_chainon): Declare.
* decl.cc (start_decl): Use attr_chainon.
(grokdeclarator): Likewise.
* parser.cc (cp_parser_statement): No longer static.
gcc/testsuite/ChangeLog:
* g++.dg/parse/error64.C: New test.
Diffstat (limited to 'gcc/cp/cp-tree.h')
-rw-r--r-- | gcc/cp/cp-tree.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index ba986e8..d77fd1e 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -7235,6 +7235,7 @@ extern void inject_this_parameter (tree, cp_cv_quals); extern location_t defparse_location (tree); extern void maybe_show_extern_c_location (void); extern bool literal_integer_zerop (const_tree); +extern tree attr_chainon (tree, tree); /* in pt.cc */ extern tree canonical_type_parameter (tree); |