* parser.c (cp_parser_class_head): Use num_template_headers_for_class.
authorJason Merrill <jason@redhat.com>
Thu, 10 May 2018 18:41:00 +0000 (14:41 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 10 May 2018 18:41:00 +0000 (14:41 -0400)
From-SVN: r260125

gcc/cp/ChangeLog
gcc/cp/parser.c

index 02d35cba4ec5f128443955ad0edc96fb3a87f711..76a7087bb218689d7e6fce8c2a47660be9c78ac0 100644 (file)
@@ -1,5 +1,7 @@
 2018-05-09  Jason Merrill  <jason@redhat.com>
 
+       * parser.c (cp_parser_class_head): Use num_template_headers_for_class.
+
        * pt.c (instantiate_decl): Make sure we aren't trying to do a nested
        instantiation in template context.
 
index 88db9988bd40ce1ae0b8679c5ffd44950fd3f93e..82b8ef87ed7c5f5fac96a5da445c3722af266ea3 100644 (file)
@@ -22930,20 +22930,7 @@ cp_parser_class_head (cp_parser* parser,
       /* Otherwise, count the number of templates used in TYPE and its
         containing scopes.  */
       else
-       {
-         tree scope;
-
-         for (scope = TREE_TYPE (type);
-              scope && TREE_CODE (scope) != NAMESPACE_DECL;
-              scope = get_containing_scope (scope))
-           if (TYPE_P (scope)
-               && CLASS_TYPE_P (scope)
-               && CLASSTYPE_TEMPLATE_INFO (scope)
-               && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (scope))
-               && (!CLASSTYPE_TEMPLATE_SPECIALIZATION (scope)
-                   || uses_template_parms (CLASSTYPE_TI_ARGS (scope))))
-             ++num_templates;
-       }
+       num_templates = num_template_headers_for_class (TREE_TYPE (type));
     }
   /* Otherwise, the identifier is optional.  */
   else