public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jason Merrill <jason@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-3550] c++: apply friend attributes sooner
Date: Fri, 28 Oct 2022 15:16:03 +0000 (GMT)	[thread overview]
Message-ID: <20221028151603.70A803851166@sourceware.org> (raw)

https://gcc.gnu.org/g:38a628f52cf0ff5db6708578248484d50a50b366

commit r13-3550-g38a628f52cf0ff5db6708578248484d50a50b366
Author: Jason Merrill <jason@redhat.com>
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;

                 reply	other threads:[~2022-10-28 15:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221028151603.70A803851166@sourceware.org \
    --to=jason@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).