Commit 0580c9aa by Martin v. Löwis Committed by Martin v. Löwis

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
parent 69063200
1999-03-03 Martin von Lwis <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> 1999-03-02 Mark Mitchell <mark@markmitchell.com>
* cp-tree.h (determine_specialization): Don't declare. * cp-tree.h (determine_specialization): Don't declare.
......
...@@ -4274,11 +4274,12 @@ push_overloaded_decl (decl, flags) ...@@ -4274,11 +4274,12 @@ push_overloaded_decl (decl, flags)
else else
{ {
/* We only create an OVERLOAD if there was a previous binding at /* We only create an OVERLOAD if there was a previous binding at
this level. In that case, we need to remove the old binding this level, or if decl is a template. In the former case, we
and replace it with the new binding. We must also run need to remove the old binding and replace it with the new
through the NAMES on the binding level where the name was binding. We must also run through the NAMES on the binding
bound to update the chain. */ level where the name was bound to update the chain. */
if (TREE_CODE (new_binding) == OVERLOAD)
if (TREE_CODE (new_binding) == OVERLOAD && old)
{ {
tree *d; tree *d;
......
...@@ -4833,11 +4833,18 @@ do_local_using_decl (decl) ...@@ -4833,11 +4833,18 @@ do_local_using_decl (decl)
{ {
if (is_overloaded_fn (newval)) if (is_overloaded_fn (newval))
{ {
tree fn; tree fn, term;
/* We only need to push declarations for those functions /* We only need to push declarations for those functions
that were not already bound in the current level. */ that were not already bound in the current level.
for (fn = newval; fn != oldval; fn = OVL_NEXT (fn)) 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_overloaded_decl (OVL_CURRENT (fn),
PUSH_LOCAL | PUSH_USING); PUSH_LOCAL | PUSH_USING);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment