https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98481
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- So, likely during 1598 cp_walk_tree_without_duplicates (&subtype, find_abi_tags_r, &data); we should avoid walking into the template parameters. I guess either it can be done by setting *walk_subtrees in find_abi_tags_r for TYPE_P and handling it manually without the walking into template args, but we'd need to repeat what walk_type_fields and cp_walk_subtrees does on types, or perhaps some global variable that will temporarily disable walking into the template parameters, or perhaps abuse the fact that *walk_subtrees is int rather than bool and for TYPE_P set *walk_subtrees to 2 rather than 1 if non-zero and treat that in cp_walk_subtrees as a request not to walk template parameters.