summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorloewis <loewis@138bc75d-0d04-0410-961f-82ee72b054a4>1998-07-14 23:34:17 +0000
committerloewis <loewis@138bc75d-0d04-0410-961f-82ee72b054a4>1998-07-14 23:34:17 +0000
commit34bc9479807e7875811fcef97eba2fb43380367a (patch)
tree43d707b0793402b201c1b995982c0da3a882c414
parentdb7fb517a2734bbfe3c49d92538f8e4aece7cea8 (diff)
downloadgcc-34bc9479807e7875811fcef97eba2fb43380367a.tar.gz
* decl2.c (add_function): Move error message ...
(arg_assoc_namespace): ... from here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@21167 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl2.c28
2 files changed, 25 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0563509c2ca..07e6b2781a3 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index b2d28012fbe..1a88ef7899f 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -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;