tree.c (equal_functions): New function.
authorMartin v. Löwis <loewis@informatik.hu-berlin.de>
Mon, 25 Jan 1999 16:09:05 +0000 (16:09 +0000)
committerMartin v. Löwis <loewis@gcc.gnu.org>
Mon, 25 Jan 1999 16:09:05 +0000 (16:09 +0000)
* tree.c (equal_functions): New function.
(ovl_member): Call it.

From-SVN: r24861

gcc/cp/ChangeLog
gcc/cp/tree.c

index 443c5de67e38e56b161de46ae7bdf9b8ad29110a..95e476714890de05f2616d8efe052e8664b253c6 100644 (file)
@@ -1,3 +1,8 @@
+1999-01-25  Martin von Löwis  <loewis@informatik.hu-berlin.de>
+
+       * tree.c (equal_functions): New function.
+       (ovl_member): Call it.
+
 1999-01-24  Jason Merrill  <jason@yorick.cygnus.com>
 
        * cvt.c (cp_convert_to_pointer): Fix conversion of 0 to pmf.
index 656cc52d036cf9fa41fbc3b1c1565adc20a9cb64..d318d1be988a23c9fd34b4cb9ec5c0e49c1e2e1d 100644 (file)
@@ -41,6 +41,7 @@ static tree list_hash_lookup PROTO((int, int, int, int, tree, tree,
 static void propagate_binfo_offsets PROTO((tree, tree));
 static int avoid_overlap PROTO((tree, tree));
 static int lvalue_p_1 PROTO((tree, int));
+static int equal_function PROTO((tree, tree));
 
 #define CEIL(x,y) (((x) + (y) - 1) / (y))
 
@@ -1395,6 +1396,20 @@ build_overload (decl, chain)
   return ovl_cons (decl, chain);
 }
 
+/* Returns true iff functions are equivalent. Equivalent functions are
+   not identical only if one is a function-local extern function.
+   This assumes that function-locals don't have TREE_PERMANENT.  */
+
+static int
+equal_functions (fn1, fn2)
+     tree fn1;
+     tree fn2;
+{
+  if (!TREE_PERMANENT (fn1) || !TREE_PERMANENT (fn2))
+    return decls_match (fn1, fn2);
+  return fn1 == fn2;
+}
+
 /* True if fn is in ovl. */
 
 int
@@ -1405,9 +1420,9 @@ ovl_member (fn, ovl)
   if (ovl == NULL_TREE)
     return 0;
   if (TREE_CODE (ovl) != OVERLOAD)
-    return decls_match (ovl, fn);
+    return equal_functions (ovl, fn);
   for (; ovl; ovl = OVL_CHAIN (ovl))
-    if (decls_match (OVL_FUNCTION (ovl), fn))
+    if (equal_functions (OVL_FUNCTION (ovl), fn))
       return 1;
   return 0;
 }