From: Martin v. Löwis Date: Wed, 3 Mar 1999 11:22:42 +0000 (+0000) Subject: decl.c (push_overloaded_decl): Only overwrite the old binding if there was one. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0580c9aa4c0518c1dd83605ae0882a5a8e03d8a7;p=gcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e5098588e76..f9b40dbdca5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +1999-03-03 Martin von Löwis + + * 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 * cp-tree.h (determine_specialization): Don't declare. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 9b5b13b6791..f7580bac4e8 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 d53dc70cf30..353033cefc5 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); }