Hello. I have this code

import std.stdio;

void foo(byte a) { writeln(typeof(a).stringof); }
void foo(short a) { writeln(typeof(a).stringof); }
void foo(int a) { writeln(typeof(a).stringof); }

void main()
{
    foo(0); // int, and byte if not define foo(int)
    foo(ushort(0)); // byte (unexpected for me)
    foo(cast(ushort)0); // byte (unexpected too)

    foo(cast(short)0); // short
    foo(short(0)); // short

    ushort x = 0;
    foo(x); // short
}

Is this a bug or I don't understand something?

Reply via email to