On Fri, Nov 19, 2021 at 10:40:50AM -0500, Jason Merrill wrote: > > Shall we also change the function so that it doesn't call > > cplus_decl_attributes if late_attrs is NULL [...]? > > Please.
Here it is. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2021-11-24 Jakub Jelinek <ja...@redhat.com> PR c++/101180 * pt.c (apply_late_template_attributes): Return early if there are no dependent attributes. --- gcc/cp/pt.c.jj 2021-11-22 10:07:01.360225139 +0100 +++ gcc/cp/pt.c 2021-11-23 11:23:16.808321905 +0100 @@ -11712,6 +11712,9 @@ apply_late_template_attributes (tree *de /* Apply any non-dependent attributes. */ *p = nondep; + if (nondep == attributes) + return true; + /* And then any dependent ones. */ tree late_attrs = NULL_TREE; tree *q = &late_attrs; Jakub