Limited type matching?
Namespace
rswhite4 at googlemail.com
Sun Sep 8 14:11:52 PDT 2013
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]?
More information about the Digitalmars-d-learn
mailing list