On Saturday, 12 March 2016 at 14:33:19 UTC, Alex wrote:

    //arr[] = 1;

The question is, why the commented out line throws the error:
Error: cannot implicitly convert expression (1) of type int to Nullable!uint[],
while the line after that works.

Looks like a bug somewhere. The work around is to cast:

arr[] = cast(Nullable!uint)1;

I suggest you file this in the bug tracker [1] if it isn't there already. Just use he minimal code that shows the problem:

void main()
{
    import std.typecons;
    Nullable!uint[] arr;
    arr.length = 5;
    arr[] = 1;
}

[1] https://dlang.org/bugstats.php


Reply via email to