From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id 07E0A3858403; Thu, 25 Nov 2021 07:42:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 07E0A3858403 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-5511] c++: Return early in apply_late_template_attributes if there are no late attribs [PR101180] X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/master X-Git-Oldrev: b38c9cf6d570f6c4c1109e00c8b81d82d0f24df3 X-Git-Newrev: 8e86218f05c1a866b43ae5af3e303f91fb6d7ff0 Message-Id: <20211125074224.07E0A3858403@sourceware.org> Date: Thu, 25 Nov 2021 07:42:24 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2021 07:42:24 -0000 https://gcc.gnu.org/g:8e86218f05c1a866b43ae5af3e303f91fb6d7ff0 commit r12-5511-g8e86218f05c1a866b43ae5af3e303f91fb6d7ff0 Author: Jakub Jelinek Date: Thu Nov 25 08:39:35 2021 +0100 c++: Return early in apply_late_template_attributes if there are no late attribs [PR101180] The r12-299-ga0fdff3cf33f7284 change can result in cplus_decl_attributes being called even if there are no late attributes (but at least one early attribute) in apply_late_template_attributes. This patch fixes that, so that we return early if there are no late attrs, only arrange for TYPE_ATTRIBUTES to get the early attribute list. 2021-11-25 Jakub Jelinek PR c++/101180 * pt.c (apply_late_template_attributes): Return early if there are no dependent attributes. Diff: --- gcc/cp/pt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 49e5745410e..221628ad3a3 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -11712,6 +11712,9 @@ apply_late_template_attributes (tree *decl_p, tree attributes, int attr_flags, /* 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;