* [pushed] c++: apply friend attributes sooner
@ 2022-10-28 15:15 Jason Merrill
0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2022-10-28 15:15 UTC (permalink / raw)
To: gcc-patches
Tested x86_64-pc-linux-gnu, applying to trunk.
-- >8 --
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.
---
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;
base-commit: 4fe34cdcc80ac225b80670eabc38ac5e31ce8a5a
--
2.31.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-10-28 15:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-28 15:15 [pushed] c++: apply friend attributes sooner Jason Merrill
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).