https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119378
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:d025b6880cde2cb2063b4d34546cdd70e5526e74 commit r14-11434-gd025b6880cde2cb2063b4d34546cdd70e5526e74 Author: Patrick Palka <ppa...@redhat.com> Date: Sat Mar 22 10:18:07 2025 -0400 c++: ICE w/ dependently scoped template friend [PR119378] Here we ICE during instantiation of the dependently scoped template friend template<int N> struct<class T> friend class A<N>::B; ultimately because processing_template_decl isn't set during substitution into the A<N> scope. Since it's naturally a partial substitution, we need to make sure the flag is set. For GCC 15, this is already fixed similarly by r15-123. PR c++/119378 gcc/cp/ChangeLog: * pt.cc (tsubst) <case UNBOUND_CLASS_TEMPLATE>: Set processing_template_decl when substituting the context. gcc/testsuite/ChangeLog: * g++.dg/template/friend85.C: New test. Reviewed-by: Jason Merrill <ja...@redhat.com>