1 matches bool, 2 matches long

Walter Bright newshound2 at digitalmars.com
Sat Apr 27 17:09:44 PDT 2013


On 4/27/2013 3:58 PM, Walter Bright wrote:
> On 4/27/2013 1:26 PM, kenji hara wrote:
>> I don't have so much knowledge about C/C++ language spec, but for the issue case
>> C++ makes "ambiguous error".
>
> That's because C++ regards an implicit conversion of 1 to bool or long as having
> equal weight, and it has no further mechanism.
>

Note that the following is also ambiguous in C++:

void foo(bool b) { }
void foo(long l) { }

void main() {
     foo(3);
}


More information about the Digitalmars-d mailing list