aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2022-01-18 18:28:22 -0500
committerJason Merrill <jason@redhat.com>2022-01-19 22:42:17 -0500
commit30f2c22def7392119f1ffaca30ef998b3b43f336 (patch)
tree9535dd5b2946c772b0e9d1fd93988362a4dac103 /gcc/cp
parent64655e7bdbea6b922f1f759eb9f1730b5e57029f (diff)
downloadgcc-30f2c22def7392119f1ffaca30ef998b3b43f336.zip
gcc-30f2c22def7392119f1ffaca30ef998b3b43f336.tar.gz
gcc-30f2c22def7392119f1ffaca30ef998b3b43f336.tar.bz2
c++: template-id with current inst qualifier [PR102300]
The patch for PR41723 properly changed one place to look into the current instantiation; now we need to fix this place as well. PR c++/102300 gcc/cp/ChangeLog: * parser.cc (cp_parser_template_name): Use dependent_scope_p. gcc/testsuite/ChangeLog: * g++.dg/parse/no-typename1.C: Remove expected error. * g++.dg/template/nested7.C: New test.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/parser.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index 00279c4..ed219d7 100644
--- 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_type_p (scope))))
+ || (check_dependency_p && dependent_scope_p (scope))))
{
/* We're optimizing away the call to cp_parser_lookup_name, but
we still need to do this. */
@@ -18667,9 +18667,9 @@ cp_parser_template_name (cp_parser* parser,
found = true;
}
- /* "in a type-only context" */
+ /* "that follows the keyword template"..."in a type-only context" */
if (!found && scope
- && tag_type != none_type
+ && (template_keyword_p || tag_type != none_type)
&& dependentish_scope_p (scope)
&& cp_parser_nth_token_starts_template_argument_list_p (parser, 1))
found = true;
@@ -18680,7 +18680,7 @@ cp_parser_template_name (cp_parser* parser,
cp_parser_error (parser, "expected template-name");
return error_mark_node;
}
- else if (decl == error_mark_node)
+ else if (!DECL_P (decl) && !is_overloaded_fn (decl))
/* Repeat the lookup at instantiation time. */
decl = identifier;
}