Call is not rejected as ambiguos

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Mon Jan 17 17:02:00 GMT 2000


> If two matches are found at the highest level where a match is found,
> tha call is rejected as ambiguous.

Thanks for your bug report. This is not a bug. Please have a look at
13.3.3.2/4 of the C++ standard, which says

# Two conversion sequences with the same rank are indistinguishable
# unless one of the following rules applies: 
# - ...
# - If class B is derived directly or indirectly from class A,
# conversion of B* to A* is better than conversion of B* to void*, and
# conversion of A* to void* is better than conversion of B* to void*.
# - ...

There is a number of other conditions that allow to select a better
candidate; please refer to the International Standard for details. It
seems that Stroustrup has simplified his explanation a bit, probably
for methodical purposes.

Hope this helps,
Martin

P.S. If you are not satisfied with this response, please ask in
comp.std.c++ first, before discussing this further.


More information about the Gcc-bugs mailing list