]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
decl2.c (add_function): Move error message ...
authorMartin v. Löwis <loewis@informatik.hu-berlin.de>
Tue, 14 Jul 1998 23:37:49 +0000 (23:37 +0000)
committerMartin v. Löwis <loewis@gcc.gnu.org>
Tue, 14 Jul 1998 23:37:49 +0000 (23:37 +0000)
* decl2.c (add_function): Move error message ...
(arg_assoc_namespace): ... from here.

From-SVN: r21168

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

index fd4f2762a8427fcc56e5e5843fd2e404a6f0dbbb..bb86ebaca0227183669561fcf86dd3df4ec34d07 100644 (file)
@@ -1,3 +1,8 @@
+1998-07-14  Martin von Löwis  <loewis@informatik.hu-berlin.de>
+
+       * decl2.c (add_function): Move error message ...
+       (arg_assoc_namespace): ... from here.
+
 1998-07-14  Jason Merrill  <jason@yorick.cygnus.com>
 
        * parse.y (namespace_qualifier): Fix multiple level handling.
index b2d28012fbeec97baf5c455da42b264beb310797..1a88ef7899f8b43585264570c8396f2baa197368 100644 (file)
@@ -4149,7 +4149,26 @@ add_function (k, fn)
 {
   if (ovl_member (fn, k->functions))
     return 0;
-  k->functions = build_overload (fn, k->functions);
+  /* We must find only functions, or exactly one non-function. */
+  if (k->functions && is_overloaded_fn (k->functions)
+      && is_overloaded_fn (fn))
+    k->functions = build_overload (fn, k->functions);
+  else 
+    if(k->functions)
+      {
+       tree f1 = OVL_CURRENT (k->functions);
+       tree f2 = fn;
+       if (is_overloaded_fn (f1))
+         {
+           fn = f1; f1 = f2; f2 = fn;
+         }
+       cp_error_at ("`%D' is not a function,", f1);
+       cp_error_at ("  conflict with `%D'", f2);
+       cp_error ("  in call to `%D'", k->name);
+       return 1;
+      }
+    else
+      k->functions = fn;
   return 0;
 }
 
@@ -4170,13 +4189,6 @@ arg_assoc_namespace (k, scope)
   if (!value)
     return 0;
   
-  if (!is_overloaded_fn (value))
-    {
-      cp_error_at ("`%D' is not a function", value);
-      cp_error ("in call to `%D'", k->name);
-      return 1;
-    }
-  
   for (; value; value = OVL_NEXT (value))
     if (add_function (k, OVL_CURRENT (value)))
       return 1;