]> gcc.gnu.org Git - gcc.git/commit
c++: Fix friend attributes [PR51344]
authorJason Merrill <jason@redhat.com>
Fri, 5 Feb 2021 15:36:49 +0000 (10:36 -0500)
committerJason Merrill <jason@redhat.com>
Thu, 29 Apr 2021 18:38:50 +0000 (14:38 -0400)
commita0fdff3cf33f72848d3f894272431a5d49fe6a16
tree1a9a9a3c4757ea89f59abca94553403318d1f79c
parent58a92b789a77cdade1f41800efebf6e0686f9982
c++: Fix friend attributes [PR51344]

51344 was a problem with calling save_template_attributes twice for the same
friend function: once from do_friend and once from grokmethod.  The 2012
patch for the bug avoided creating an infinite loop when this happens, but
it's better to avoid the duplication in the first place.  This also restores
the dependent attributes to the beginning of the attribute list, as
originally intended.  And then apply_late_template_attributes can avoid
copying the non-dependent attributes.

gcc/cp/ChangeLog:

PR c++/51344
* decl2.c (grokfield): Call cplus_decl_attributes for friend.
(save_template_attributes): Use chainon.
* friend.c (do_friend): Remove attrlist parm.
* cp-tree.h (do_friend): Adjust.
* class.c (add_implicitly_declared_members): Adjust.
* decl.c (grokdeclarator): Adjust.
* pt.c (apply_late_template_attributes): Optimize.
gcc/cp/class.c
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/friend.c
gcc/cp/pt.c
This page took 0.063226 seconds and 5 git commands to generate.