My code:

alias MemSize = ushort;

struct MemRegion
{
        MemSize start;
        MemSize length;
        @property MemSize end() const { return start+length; }
}

Error: cannot implicitly convert expression `cast(int)this.start + cast(int)this.length` of type `int` to `ushort`

Both operands are the same type, so as I understand casting to longest type is not needed at all, and longest type here is ushort in any case. What am I doing wrong?

Reply via email to