diff mbox series

c++: Return early in apply_late_template_attributes if there are no late attribs [PR101180]

Message ID 20211124081612.GH2646553@tucnak
State New
Headers show
Series c++: Return early in apply_late_template_attributes if there are no late attribs [PR101180] | expand

Commit Message

Jakub Jelinek Nov. 24, 2021, 8:16 a.m. UTC
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  <jakub@redhat.com>

	PR c++/101180
	* pt.c (apply_late_template_attributes): Return early if there are no
	dependent attributes.



	Jakub

Comments

Jason Merrill Nov. 25, 2021, 2:43 a.m. UTC | #1
On 11/24/21 03:16, Jakub Jelinek wrote:
> 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?

OK.

> 2021-11-24  Jakub Jelinek  <jakub@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
>
diff mbox series

Patch

--- 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;