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.