aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-11-03 10:05:04 -0800
committerNathan Sidwell <nathan@acm.org>2020-11-03 10:07:21 -0800
commit5b01425ec2019f822f9eb628ef0932f6deff44f9 (patch)
tree1d4f5301e70c1d0fcd911b510b18b78a6d773cce
parent8bd9a00f4349ebcd65223e3dcdfe83867e417287 (diff)
downloadgcc-5b01425ec2019f822f9eb628ef0932f6deff44f9.zip
gcc-5b01425ec2019f822f9eb628ef0932f6deff44f9.tar.gz
gcc-5b01425ec2019f822f9eb628ef0932f6deff44f9.tar.bz2
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.
-rw-r--r--gcc/cp/pt.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index f1c8c09..388423b 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)),