Is there any gcc flag to forbid implicit "bool -> int" conversion?
I want to get any warning with this code:
void function( int value, bool flag ) { }
int main()
{
int a = 123;
bool flag = true;
//oops, a common mistake
function( flag, a );
}
As a workaround, in C++11, you may delete the other possible overloads:
template <typename T> void function(int, T) = delete;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With