https://issues.dlang.org/show_bug.cgi?id=23297

Ruby The Roobster <rubytheroobs...@yandex.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|dlang.org                   |dmd
           Severity|enhancement                 |normal

--- Comment #3 from Ruby The Roobster <rubytheroobs...@yandex.com> ---
(In reply to anonymous4 from comment #1)
> The second example should work, it's array copy - copies elements from one
> array to another. The first example is slice assignment that would refer to
> the same array.

Can you be more clear?  I think you got the two examples mixed up.

Also, the second example compiles with wchar and char, not just dchar, and the
following works:

```d
void main()
{
    wchar[] a = "ab"w.dup;
    wchar[]b = a.dup;
    import std.stdio;
    writeln("Type of a[0 .. $-1]: ", typeof(a[0 .. $-1]).stringof);
    writeln("Type of b[1 .. $].idup: ", typeof(b[1 .. $].idup).stringof);
    a[0 .. $-1] = b[1 .. $].idup; //See?  Two completely different arrays.
    --a.length;
    writeln(a);
    writeln(typeof(a).stringof);
}
```

This is assigning an array of immutable wchars to an array of mutable wchars. 
No matter how you put it, this is a violation of the type system.

--

Reply via email to