aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-05-10 14:41:00 -0400
committerJason Merrill <jason@gcc.gnu.org>2018-05-10 14:41:00 -0400
commit2c9c6adac944e2705131400a24570ae884388c71 (patch)
tree205934adca5326abd2b7cfc5cb4be6bbcd1f1dc9 /gcc
parent5d7b4c6fe9b1d69417c0c2e8f618603d2d93b2d3 (diff)
downloadgcc-2c9c6adac944e2705131400a24570ae884388c71.zip
gcc-2c9c6adac944e2705131400a24570ae884388c71.tar.gz
gcc-2c9c6adac944e2705131400a24570ae884388c71.tar.bz2
* parser.c (cp_parser_class_head): Use num_template_headers_for_class.
From-SVN: r260125
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog2
-rw-r--r--gcc/cp/parser.c15
2 files changed, 3 insertions, 14 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 02d35cb..76a7087 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 88db998..82b8ef8 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -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