[Bug c++/104365] Overload ambiguity not detected

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Feb 3 14:03:13 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104365

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Andris Pavenis from comment #5)
> The warning should be in case when both
> 1) there is preferred standard conversion sequence for parameter of one
> overloaded method

Standard conversions include T -> const T&, and derived-to-base conversions,
and 
T* -> void*. I don't think anybody would be surprised that those conversions
beat a user-defined one.

> 2) there is other user defined conversion sequences for one more more other
> overloaded methods

And non-member functions?


(In reply to Andris Pavenis from comment #6)
> 20220203-1.cpp:19:24: warning: call of overloaded 'Test(const char [4],
> unsigned 
> char[4])' is ambiguous


"is ambiguous" is incorrect though, so it would have to be clear that there is
no ambiguity in C++ terms, just potential for confusion.


More information about the Gcc-bugs mailing list