Topic: compound ambiguity
Author: erc@netcom.com (Eric Smith)
Date: Fri, 21 May 1993 09:13:57 GMT Raw View
The following short example code is ambiguous, because in function f2, the
call to f1 requires converting from class A to either void* or int, and
class A has conversions whose results can be converted to either.
However, what is the exact rule? f1(void*) does not involve any ambiguity,
because only char* can convert to void* in this case. Thus, f1(void*) might
seem ok, if f1(int) can be eliminated. And f1(int) can indeed be eliminated
because the conversions to int are ambiguous.
To restate the question more concisely, can one ambiguity cancel another
by eliminating itself from consideration? Is this answered in the ARM?
class A {
public:
operator short();
operator char();
operator char*();
}
void f1(void*);
void f1(int);
void f2() {A a; f1(a);}