https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104235
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> --- I guess we want --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -18574,7 +18574,7 @@ cp_parser_template_name (cp_parser* parser, : parser->context->object_type); if (scope && TYPE_P (scope) && (!CLASS_TYPE_P (scope) - || (check_dependency_p && dependent_scope_p (scope)))) + || (check_dependency_p && dependentish_scope_p (scope)))) { /* We're optimizing away the call to cp_parser_lookup_name, but we still need to do this. */ because the scope here (L<M>) has dependent bases.