From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2122) id 70A803851166; Fri, 28 Oct 2022 15:16:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 70A803851166 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666970163; bh=3ndtHqd543DtKkIIoGb9JC/3gNMr6QnlyViLx7vyhk0=; h=From:To:Subject:Date:From; b=QXzVbv/X3RebmYf9+l+8orZBxmERoR20B6JSDAQ1Wnbs/gTf9boZcxT/qvnLjG67V lEl5HpY9/KLeuCCvEjjYGxluJDqNr6pOB27S8x7ulEX3VGcuCnp1VXgFnFEvDrhS41 kZYiYu28972fhmVezXZld11E0qg+2K9iEv0GMNj8= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jason Merrill To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3550] c++: apply friend attributes sooner X-Act-Checkin: gcc X-Git-Author: Jason Merrill X-Git-Refname: refs/heads/master X-Git-Oldrev: 4fe34cdcc80ac225b80670eabc38ac5e31ce8a5a X-Git-Newrev: 38a628f52cf0ff5db6708578248484d50a50b366 Message-Id: <20221028151603.70A803851166@sourceware.org> Date: Fri, 28 Oct 2022 15:16:03 +0000 (GMT) List-Id: https://gcc.gnu.org/g:38a628f52cf0ff5db6708578248484d50a50b366 commit r13-3550-g38a628f52cf0ff5db6708578248484d50a50b366 Author: Jason Merrill Date: Fri Oct 28 10:45:06 2022 -0400 c++: apply friend attributes sooner Comparing attributes between declarations of a friend function has been complicated by pushdecl happening before decl_attributes. I assumed there was some complicated reason we weren't calling decl_attributes here, but it doesn't break anything. gcc/cp/ChangeLog: * decl.cc (grokdeclarator): Call decl_attributes before do_friend. Diff: --- gcc/cp/decl.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index bc085f8fcce..c7f1937ea48 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -14206,13 +14206,16 @@ grokdeclarator (const cp_declarator *declarator, else if (decl && DECL_NAME (decl)) { set_originating_module (decl, true); - + if (initialized) /* Kludge: We need funcdef_flag to be true in do_friend for in-class defaulted functions, but that breaks grokfndecl. So set it here. */ funcdef_flag = true; + cplus_decl_attributes (&decl, *attrlist, 0); + *attrlist = NULL_TREE; + decl = do_friend (ctype, unqualified_id, decl, flags, funcdef_flag); return decl;