* decl.c (pushdecl): Don't set DECL_CONTEXT for a template
paramter.
* lex.c (do_identifier): Use DECL_TEMPLATE_PARM_P.
- (push_inline_template_parms_recursive): Set it.
+ * pt.c (push_inline_template_parms_recursive): Set it.
(decl_template_parm_p): Remove.
(check_template_shadow): Use DECL_TEMPLATE_PARM_P.
(process_template_parm): Set it.
case PARM_DECL:
{
- /* Make a CONST_DECL as is done in process_template_parm. */
+ /* Make a CONST_DECL as is done in process_template_parm.
+ It is ugly that we recreate this here; the original
+ version built in process_template_parm is no longer
+ available. */
tree decl = build_decl (CONST_DECL, DECL_NAME (parm),
TREE_TYPE (parm));
+ SET_DECL_ARTIFICIAL (decl);
DECL_INITIAL (decl) = DECL_INITIAL (parm);
+ DECL_TEMPLATE_PARM_P (decl) = 1;
pushdecl (decl);
}
break;
return 1;
}
-
-/* Returns 1 iff DECL is a template parameter. */
-
-int decl_template_parm_p (decl)
- tree decl;
-{
- /* For template template parms. */
- if (TREE_CODE (decl) == TEMPLATE_DECL
- && TREE_TYPE (decl)
- && TREE_CODE (TREE_TYPE (decl)) == TEMPLATE_TEMPLATE_PARM)
- return 1;
-
- /* For template type parms. */
- if (TREE_CODE (decl) == TYPE_DECL
- && TREE_TYPE (decl)
- && TREE_CODE (TREE_TYPE (decl)) == TEMPLATE_TYPE_PARM)
- return 1;
-
- /* For template non-type parms. */
- if (TREE_CODE (decl) == CONST_DECL
- && DECL_INITIAL (decl)
- && TREE_CODE (DECL_INITIAL (decl)) == TEMPLATE_PARM_INDEX)
- return 1;
-
- return 0;
-}
-
/* Complain if DECL shadows a template parameter.
[temp.local]: A template-parameter shall not be redeclared within its
/* We check for decl != olddecl to avoid bogus errors for using a
name inside a class. We check TPFI to avoid duplicate errors for
inline member templates. */
- if (decl != olddecl && decl_template_parm_p (olddecl)
+ if (decl != olddecl && DECL_TEMPLATE_PARM_P (olddecl)
&& ! TEMPLATE_PARMS_FOR_INLINE (current_template_parms))
{
cp_error_at ("declaration of `%#D'", decl);
decl, TREE_TYPE (parm));
}
SET_DECL_ARTIFICIAL (decl);
+ DECL_TEMPLATE_PARM_P (decl) = 1;
pushdecl (decl);
parm = build_tree_list (defval, parm);
return chainon (list, parm);