aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin v. Löwis <loewis@informatik.hu-berlin.de>1999-03-03 11:22:42 +0000
committerMartin v. Löwis <loewis@gcc.gnu.org>1999-03-03 11:22:42 +0000
commit0580c9aa4c0518c1dd83605ae0882a5a8e03d8a7 (patch)
treee0fb4e88d0901c8a4b98eb878b4613e43ca2bbf4 /gcc
parent69063200c247f1bb05d369b0f6b396858d9190d0 (diff)
downloadgcc-0580c9aa4c0518c1dd83605ae0882a5a8e03d8a7.zip
gcc-0580c9aa4c0518c1dd83605ae0882a5a8e03d8a7.tar.gz
gcc-0580c9aa4c0518c1dd83605ae0882a5a8e03d8a7.tar.bz2
decl.c (push_overloaded_decl): Only overwrite the old binding if there was one.
* decl.c (push_overloaded_decl): Only overwrite the old binding if there was one. * decl2.c (do_local_using_decl): Fix loop termination. From-SVN: r25560
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c11
-rw-r--r--gcc/cp/decl2.c13
3 files changed, 22 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e509858..f9b40db 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+1999-03-03 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * decl.c (push_overloaded_decl): Only overwrite the old binding if
+ there was one.
+ * decl2.c (do_local_using_decl): Fix loop termination.
+
1999-03-02 Mark Mitchell <mark@markmitchell.com>
* cp-tree.h (determine_specialization): Don't declare.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 9b5b13b..f7580ba 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4274,11 +4274,12 @@ push_overloaded_decl (decl, flags)
else
{
/* We only create an OVERLOAD if there was a previous binding at
- this level. In that case, we need to remove the old binding
- and replace it with the new binding. We must also run
- through the NAMES on the binding level where the name was
- bound to update the chain. */
- if (TREE_CODE (new_binding) == OVERLOAD)
+ this level, or if decl is a template. In the former case, we
+ need to remove the old binding and replace it with the new
+ binding. We must also run through the NAMES on the binding
+ level where the name was bound to update the chain. */
+
+ if (TREE_CODE (new_binding) == OVERLOAD && old)
{
tree *d;
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index d53dc70..353033c 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -4833,11 +4833,18 @@ do_local_using_decl (decl)
{
if (is_overloaded_fn (newval))
{
- tree fn;
+ tree fn, term;
/* We only need to push declarations for those functions
- that were not already bound in the current level. */
- for (fn = newval; fn != oldval; fn = OVL_NEXT (fn))
+ that were not already bound in the current level.
+ The old value might be NULL_TREE, it might be a single
+ function, or an OVERLOAD. */
+ if (oldval && TREE_CODE (oldval) == OVERLOAD)
+ term = OVL_FUNCTION (oldval);
+ else
+ term = oldval;
+ for (fn = newval; fn && OVL_CURRENT (fn) != term;
+ fn = OVL_NEXT (fn))
push_overloaded_decl (OVL_CURRENT (fn),
PUSH_LOCAL | PUSH_USING);
}