C++ Logo

std-proposals

Advanced search

Re: [std-proposals] resolving function overloading ambiguity for bool arguments

From: Anoop Rana <ranaanoop986_at_[hidden]>
Date: Fri, 9 Jan 2026 22:24:06 +0530
Also, using keyword explicit for this purpose doesn't seem right. I would
avoid overloading keyword explicit here as it already has a different
meaning.

On Fri, 9 Jan 2026, 22:10 Brian Bi via Std-Proposals, <
std-proposals_at_[hidden]> wrote:

>
>
> On Fri, Jan 9, 2026 at 11:38 AM Steve Weinrich via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>
>> Consider two methods:
>>
>>
>>
>> void interest (double arg1, bool minor);
>>
>> void interest (double arg1, int factor);
>>
>>
>>
>> The call: interest(5.5, 5); is ambiguous because 5 will freely convert to
>> a bool.
>>
>
> No it's not.
>
>
>>
>>
>> I was wondering what y’all would think of narrowing this behavior by this
>> addition:
>>
>>
>>
>> void interest (double arg1, *explicit* bool minor);
>>
>>
>>
>> Potentially, this could be applied to all arguments:
>>
>>
>>
>> void *explicit* interest (double arg1, bool minor);
>>
>>
>>
>> Thanks,
>>
>> Steve
>> --
>> Std-Proposals mailing list
>> Std-Proposals_at_[hidden]
>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>>
>
>
> --
> *Brian Bi*
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2026-01-09 16:54:20