aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Kosnik <bkoz@gcc.gnu.org>1998-08-24 11:57:04 +0000
committerBenjamin Kosnik <bkoz@gcc.gnu.org>1998-08-24 11:57:04 +0000
commit22a7be536556ba3c95cc1c0a739ace2382405447 (patch)
tree81cb257b7613ab91776fc140da74d52c8a101b80
parent037155f1fdb64e4bb73b0d2e243df3694277d85a (diff)
downloadgcc-22a7be536556ba3c95cc1c0a739ace2382405447.zip
gcc-22a7be536556ba3c95cc1c0a739ace2382405447.tar.gz
gcc-22a7be536556ba3c95cc1c0a739ace2382405447.tar.bz2
cp-tree.h: Declare.
h 1998-08-24 Benjamin Kosnik <bkoz@cygnus.com> * 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
-rw-r--r--gcc/cp/pt.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 79a00fa..e76c509 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