Implicit conversion rules

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Oct 21 12:49:35 PDT 2015


On 10/21/2015 12:37 PM, Sigg wrote:

 > cause at least few more "fun" side effects.

One of those side effects would be function calls binding silently to 
another overload:

void foo(bool){/* ... */}
void foo(int) {/* ... */}

   auto a = 0;  // If the type were deduced by the value,
   foo(a);      // then this would be a call to foo(bool)...
                // until someone changed the value to 2. :)

Ali



More information about the Digitalmars-d-learn mailing list