https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101894
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-11 branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:ad4b23729b2e57676efb3d8313f4fc5300b94339 commit r11-9826-gad4b23729b2e57676efb3d8313f4fc5300b94339 Author: Jason Merrill <ja...@redhat.com> Date: Fri Apr 1 16:18:31 2022 -0400 c++: repeated friend template [PR101894] Since olddecl isn't a definition, it doesn't get DECL_FRIEND_CONTEXT, so we need to copy it from newdecl when we merge the declarations. PR c++/101894 gcc/cp/ChangeLog: * decl.c (duplicate_decls): Copy DECL_FRIEND_CONTEXT. gcc/testsuite/ChangeLog: * g++.dg/lookup/friend22.C: New test.