From 22a7be536556ba3c95cc1c0a739ace2382405447 Mon Sep 17 00:00:00 2001 From: Benjamin Kosnik Date: Mon, 24 Aug 1998 11:57:04 +0000 Subject: [PATCH] cp-tree.h: Declare. h 1998-08-24 Benjamin Kosnik * cp-tree.h: Declare. * pt.c (decl_template_parm_p): New function. * decl.c (pushdecl): Check decls for redeclaring template parms. (xref_tag): Make redeclaration an error, print decl. * decl2.c (grokfield): Check field_decls for redeclaration as well. From-SVN: r21942 --- gcc/cp/pt.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 79a00fad65c..e76c509d04b 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1451,7 +1451,27 @@ int comp_template_parms (parms1, parms2) return 1; } -/* Return a new TEMPLATE_PARM_INDEX with the indicated INDEX, LEVEL, + +/* Returns 1 iff old_id is a template parameter. OLD_DECL is the decl + from IDENTIFIER_LOCAL_VALUE (new identifier). */ + +int decl_template_parm_p (old_decl) + tree old_decl; +{ + if (TREE_CODE_CLASS (TREE_CODE (old_decl)) == 'd' + /* For template type parameters. */ + && ((TREE_TYPE (old_decl) + && TREE_CODE (TREE_TYPE (old_decl)) == TEMPLATE_TYPE_PARM) + /* For non-type template parameters. */ + || (DECL_INITIAL (old_decl) + && TREE_CODE (DECL_INITIAL (old_decl)) == TEMPLATE_PARM_INDEX))) + return 1; + else + return 0; +} + + + /* Return a new TEMPLATE_PARM_INDEX with the indicated INDEX, LEVEL, ORIG_LEVEL, DECL, and TYPE. */ static tree -- 2.30.2