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.

pushing to trunk
--
Nathan Sidwell
diff --git i/gcc/cp/pt.c w/gcc/cp/pt.c
index f1c8c0913ec..388423ba143 100644
--- i/gcc/cp/pt.c
+++ w/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)),

Reply via email to