Limited type matching?

Kenji Hara k.hara.pg at gmail.com
Mon Sep 9 20:58:52 PDT 2013


On Monday, 9 September 2013 at 11:36:42 UTC, Andrej Mitrovic 
wrote:
> On 9/8/13, Namespace <rswhite4 at googlemail.com> wrote:
>> 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]?
>
> Oh I didn't even noticed it was a signed/unsigned issue. I'm 
> not sure
> whether or not it's a bug. But file it anyways and someone will 
> know
> what to do with it.

Currently, all of array types does not allow copy-conversion like 
ushort to short for their elements.

In old D1 age, static array did not have value semantics, so the 
behavior was expected.
In D2, static array had changed to value type, but the behavior 
was not changed.

As far as I know, there was no discussion about that, but at 
least it is not fundamentally wrong.

Kenji Hara


More information about the Digitalmars-d-learn mailing list