https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41723
--- 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:fb5ed6d8c90a4bf8e677a3ff9bd79d83636ccff9 commit r11-8035-gfb5ed6d8c90a4bf8e677a3ff9bd79d83636ccff9 Author: Jason Merrill <ja...@redhat.com> Date: Wed Apr 7 16:42:44 2021 -0400 c++: friend with redundant qualification [PR41723] Different code paths were correctly choosing to look up D directly, since C is the current instantiation, but here we decided to try to make it a typename type, leading to confusion. Fixed by using dependent_scope_p as we do elsewhere. gcc/cp/ChangeLog: PR c++/41723 * parser.c (cp_parser_class_name): Check dependent_scope_p. gcc/testsuite/ChangeLog: PR c++/41723 * g++.dg/template/friend71.C: New test.