aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1997-09-02 21:33:28 +0000
committerJason Merrill <jason@gcc.gnu.org>1997-09-02 17:33:28 -0400
commit37dac03995186a0404c5f17a39d69c8bb248dfc9 (patch)
tree7229aa1bf3cddb9b1b794928616ef39229804291
parentca79f85d9db6e768bfa918ea4d490692ff996c41 (diff)
downloadgcc-37dac03995186a0404c5f17a39d69c8bb248dfc9.zip
gcc-37dac03995186a0404c5f17a39d69c8bb248dfc9.tar.gz
gcc-37dac03995186a0404c5f17a39d69c8bb248dfc9.tar.bz2
method.c (build_overload_value): Add in_template parm.
* method.c (build_overload_value): Add in_template parm. (build_overload_int): Likewise. (build_overload_identifier): Pass it. * decl.c (duplicate_decls): Don't bash a previous template definition with a redeclaration. From-SVN: r15040
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/decl.c9
-rw-r--r--gcc/cp/method.c24
3 files changed, 26 insertions, 14 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index fc5a66b..cef8c96 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,12 @@
Tue Sep 2 12:09:13 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * method.c (build_overload_value): Add in_template parm.
+ (build_overload_int): Likewise.
+ (build_overload_identifier): Pass it.
+
+ * decl.c (duplicate_decls): Don't bash a previous template
+ definition with a redeclaration.
+
* pt.c (unify): float doesn't match double.
* pt.c (do_type_instantiation): Handle getting a _TYPE or a
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 1f755cc..eb574e8 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -2698,9 +2698,12 @@ duplicate_decls (newdecl, olddecl)
if (TREE_CODE (newdecl) == TEMPLATE_DECL)
{
- TREE_TYPE (olddecl) = TREE_TYPE (newdecl);
- DECL_TEMPLATE_RESULT (olddecl) = DECL_TEMPLATE_RESULT (newdecl);
- DECL_TEMPLATE_PARMS (olddecl) = DECL_TEMPLATE_PARMS (newdecl);
+ if (DECL_INITIAL (DECL_TEMPLATE_RESULT (olddecl)) == NULL_TREE)
+ {
+ TREE_TYPE (olddecl) = TREE_TYPE (newdecl);
+ DECL_TEMPLATE_RESULT (olddecl) = DECL_TEMPLATE_RESULT (newdecl);
+ DECL_TEMPLATE_PARMS (olddecl) = DECL_TEMPLATE_PARMS (newdecl);
+ }
return 1;
}
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 24026e7..45108ea 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -63,10 +63,10 @@ static void dicat PROTO((HOST_WIDE_INT, HOST_WIDE_INT));
static void flush_repeats PROTO((tree));
static void build_overload_identifier PROTO((tree));
static void build_overload_nested_name PROTO((tree));
-static void build_overload_int PROTO((tree));
+static void build_overload_int PROTO((tree, int));
static void build_overload_identifier PROTO((tree));
static void build_qualified_name PROTO((tree));
-static void build_overload_value PROTO((tree, tree));
+static void build_overload_value PROTO((tree, tree, int));
static char *thunk_printable_name PROTO((tree));
static void do_build_assign_ref PROTO((tree));
static void do_build_copy_constructor PROTO((tree));
@@ -409,8 +409,9 @@ build_overload_nested_name (decl)
/* Encoding for an INTEGER_CST value. */
static void
-build_overload_int (value)
+build_overload_int (value, in_template)
tree value;
+ int in_template;
{
if (TREE_CODE (value) == TEMPLATE_CONST_PARM)
{
@@ -422,7 +423,7 @@ build_overload_int (value)
OB_PUTC ('_');
return;
}
- else if (processing_template_decl
+ else if (in_template
&& TREE_CODE (value) != INTEGER_CST)
/* We don't ever want this output, but it's inconvenient not to
be able to build the string. This should cause assembler
@@ -451,8 +452,9 @@ build_overload_int (value)
}
static void
-build_overload_value (type, value)
+build_overload_value (type, value, in_template)
tree type, value;
+ int in_template;
{
while (TREE_CODE (value) == NON_LVALUE_EXPR
|| TREE_CODE (value) == NOP_EXPR)
@@ -488,7 +490,7 @@ build_overload_value (type, value)
case ENUMERAL_TYPE:
case BOOLEAN_TYPE:
{
- build_overload_int (value);
+ build_overload_int (value, in_template);
numeric_output_need_bar = 1;
return;
}
@@ -574,9 +576,9 @@ build_overload_value (type, value)
if (TREE_CODE (a1) == INTEGER_CST
&& TREE_CODE (a2) == INTEGER_CST)
{
- build_overload_int (a1);
+ build_overload_int (a1, in_template);
OB_PUTC ('_');
- build_overload_int (a2);
+ build_overload_int (a2, in_template);
OB_PUTC ('_');
if (TREE_CODE (a3) == ADDR_EXPR)
{
@@ -591,7 +593,7 @@ build_overload_value (type, value)
else if (TREE_CODE (a3) == INTEGER_CST)
{
OB_PUTC ('i');
- build_overload_int (a3);
+ build_overload_int (a3, in_template);
numeric_output_need_bar = 1;
return;
}
@@ -603,7 +605,7 @@ build_overload_value (type, value)
if (TREE_CODE (value) == INTEGER_CST
|| TREE_CODE (value) == TEMPLATE_CONST_PARM)
{
- build_overload_int (value);
+ build_overload_int (value, in_template);
numeric_output_need_bar = 1;
return;
}
@@ -668,7 +670,7 @@ build_overload_identifier (name)
TREE_VEC_LENGTH (arglist), NULL_TREE);
/* It's a PARM_DECL. */
build_overload_name (TREE_TYPE (parm), 0, 0);
- build_overload_value (parm, arg);
+ build_overload_value (parm, arg, uses_template_parms (arglist));
}
}
}