diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index c915d6415de..59adac4492a 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -24639,7 +24639,7 @@ cp_parser_class_name (cp_parser *parser, const bool typename_p = (typename_keyword_p && parser->scope && TYPE_P (parser->scope) - && dependent_type_p (parser->scope)); + && dependent_scope_p (parser->scope)); /* Handle the common case (an identifier, but not a template-id) efficiently. */ if (token->type == CPP_NAME diff --git a/gcc/testsuite/g++.dg/template/friend71.C b/gcc/testsuite/g++.dg/template/friend71.C new file mode 100644 index 00000000000..939ea6b5264 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/friend71.C @@ -0,0 +1,8 @@ +// PR c++/41723 + +template +class C { + template class D {}; + + friend class C::D; +};