aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2022-10-28 10:45:06 -0400
committerJason Merrill <jason@redhat.com>2022-10-28 11:15:35 -0400
commit38a628f52cf0ff5db6708578248484d50a50b366 (patch)
tree57ec86ab5641f1b8d07b22bf0280d06e8d3c8a9f /gcc
parent4fe34cdcc80ac225b80670eabc38ac5e31ce8a5a (diff)
downloadgcc-38a628f52cf0ff5db6708578248484d50a50b366.zip
gcc-38a628f52cf0ff5db6708578248484d50a50b366.tar.gz
gcc-38a628f52cf0ff5db6708578248484d50a50b366.tar.bz2
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/decl.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index bc085f8..c7f1937 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;