Code:

----
import std.stdio;

void foo(short x, short y) { }
void foo(short[2] xy) { }

void main()
{
        foo(1, 2); /// works
        foo([1, 2]); /// works
        
        ushort[2] xy = [1, 2];
        foo(xy); /// fails
        
        ushort x = 1, y = 2;
        foo(x, y); /// works
}
----

What is the problem? If the compiler is able to cast implicit from ushort to short, what is the problem of casting ushort[2] to short[2]?

Reply via email to