]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: parsing injected-class-name as template
authorJason Merrill <jason@redhat.com>
Fri, 13 May 2022 01:28:47 +0000 (21:28 -0400)
committerJason Merrill <jason@redhat.com>
Sun, 15 May 2022 16:41:14 +0000 (12:41 -0400)
While I was backporting the patch for PR102300, it occurred to me that it
would be cleaner to look through the injected-class-name earlier in the
function.  I don't think this changes any test results.

gcc/cp/ChangeLog:

* parser.cc (cp_parser_template_name): Look through
injected-class-name.

gcc/cp/parser.cc

index 8969ed0076a649f1f8c5cde6aebd7dce106482eb..d4dab6cf84e2f09393ce498a6b29cb2acfeb3964 100644 (file)
@@ -18646,6 +18646,9 @@ cp_parser_template_name (cp_parser* parser,
     (9.3.4), or in a type-only context other than a nested-name-specifier
     (13.8).  */
 
+  /* Handle injected-class-name.  */
+  decl = maybe_get_template_decl_from_type_decl (decl);
+
   /* If DECL is a template, then the name was a template-name.  */
   if (TREE_CODE (decl) == TEMPLATE_DECL)
     {