From 5b01425ec2019f822f9eb628ef0932f6deff44f9 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Tue, 3 Nov 2020 10:05:04 -0800 Subject: [PATCH] c++: Small pt.c cleanups Now I know about VAR_OR_FUNCTION_DECL_P I found a place to use it. Also positively checking for a function_decl is clearer than negatively checking for things that are not. gcc/cp/ * pt.c (primary_template_specialization_p): Use VAR_OR_FUNCTION_DECL_P. (tsubst_template_decl): Check for FUNCTION_DECL, not !TYPE && !VAR for registering a specialization. --- gcc/cp/pt.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index f1c8c0913ec..388423ba143 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -3634,7 +3634,7 @@ primary_template_specialization_p (const_tree t) if (!t) return false; - if (TREE_CODE (t) == FUNCTION_DECL || VAR_P (t)) + if (VAR_OR_FUNCTION_DECL_P (t)) return (DECL_LANG_SPECIFIC (t) && DECL_USE_TEMPLATE (t) && DECL_TEMPLATE_INFO (t) @@ -14220,8 +14220,7 @@ tsubst_template_decl (tree t, tree args, tsubst_flags_t complain, if (PRIMARY_TEMPLATE_P (t)) DECL_PRIMARY_TEMPLATE (r) = r; - if (TREE_CODE (decl) != TYPE_DECL && !VAR_P (decl) - && !lambda_fntype) + if (TREE_CODE (decl) == FUNCTION_DECL && !lambda_fntype) /* Record this non-type partial instantiation. */ register_specialization (r, t, DECL_TI_ARGS (DECL_TEMPLATE_RESULT (r)), -- 2.30.2