+Thu Mar 26 10:24:05 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * call.c (build_object_call): Complain about ambiguous operator(),
+ rather that crashing.
+ (build_new_op): Likewise.
+ (build_op_delete_call): Likewise.
+
Thu Mar 26 10:23:24 1998 Mark Mitchell <mmitchell@usa.net>
* cvt.c (perform_qualification_conversions): Use comp_target_types
return error_mark_node;
}
- fns = lookup_fnfields (TYPE_BINFO (type), ansi_opname [CALL_EXPR], 0);
+ fns = lookup_fnfields (TYPE_BINFO (type), ansi_opname [CALL_EXPR], 1);
+ if (fns == error_mark_node)
+ return error_mark_node;
args = resolve_args (args);
}
if (IS_AGGR_TYPE (TREE_TYPE (arg1)))
- fns = lookup_fnfields (TYPE_BINFO (TREE_TYPE (arg1)), fnname, 0);
+ {
+ fns = lookup_fnfields (TYPE_BINFO (TREE_TYPE (arg1)), fnname, 1);
+ if (fns == error_mark_node)
+ return fns;
+ }
else
fns = NULL_TREE;
fnname = ansi_opname[code];
if (IS_AGGR_TYPE (type) && ! (flags & LOOKUP_GLOBAL))
- fns = lookup_fnfields (TYPE_BINFO (type), fnname, 0);
+ /* In [class.free]
+
+ If the result of the lookup is ambiguous or inaccessible, or if
+ the lookup selects a placement deallocation function, the
+ program is ill-formed.
+
+ Therefore, we ask lookup_fnfields to complain ambout ambiguity. */
+ {
+ fns = lookup_fnfields (TYPE_BINFO (type), fnname, 1);
+ if (fns == error_mark_node)
+ return error_mark_node;
+ }
else
fns = NULL_TREE;
--- /dev/null
+// Build don't link:
+
+struct A {
+ int operator ++();
+ void operator ()();
+ void operator delete(void*);
+};
+
+struct B {
+ int operator ++(int);
+ void operator ()();
+ void operator delete(void*);
+ void f();
+};
+
+struct C : public A, public B {
+};
+
+void f()
+{
+ C c;
+ C* cp;
+
+ delete cp; // ERROR - ambiguous
+ c(); // ERROR - ambiguous
+ c++; // ERROR - ambiguous
+}
+