C++ Logo

std-proposals

Advanced search

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

From: <weinrich.steve_at_[hidden]>
Date: Fri, 9 Jan 2026 09:37:51 -0700
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.

 

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


Received on 2026-01-09 16:37:55