https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101894
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:3afc7c4eeada0a04c2c4ededeb0f6ccc724a58ec commit r12-7985-g3afc7c4eeada0a04c2c4ededeb0f6ccc724a58ec 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.cc (duplicate_decls): Copy DECL_FRIEND_CONTEXT. gcc/testsuite/ChangeLog: * g++.dg/lookup/friend22.C: New test.