decl.c (push_overloaded_decl): Only overwrite the old binding if there was one.
authorMartin v. Löwis <loewis@informatik.hu-berlin.de>
Wed, 3 Mar 1999 11:22:42 +0000 (11:22 +0000)
committerMartin v. Löwis <loewis@gcc.gnu.org>
Wed, 3 Mar 1999 11:22:42 +0000 (11:22 +0000)
* 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

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/decl2.c

index e5098588e76346a36253535bcc778cde833a5265..f9b40dbdca543ef4a44daa1314d06f5063c899db 100644 (file)
@@ -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.
index 9b5b13b67916a5e2776e0cc3828df117acd07491..f7580bac4e862d3e3f27992eba3c13c0b27c132e 100644 (file)
@@ -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;
          
index d53dc70cf3004f4491c4bb582835fefde7f82722..353033cefc5a3f136f7a4779b84cb47ea92bf85a 100644 (file)
@@ -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);
        }