[Issue 21572] Implicit conversion from `immutable(T)[][]` to `scope const(T)[][]` is missing

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 22 14:17:42 UTC 2021


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

ag0aep6g <ag0aep6g at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |ag0aep6g at gmail.com
         Resolution|---                         |INVALID

--- Comment #1 from ag0aep6g <ag0aep6g at gmail.com> ---
Conversion from `immutable(char)[][]` to `const(char)[][]` is not sound.
Consider:

    immutable(char)[][] i = [""];
    const(char)[][] c = i;
    char[] m = ['x'];
    c[0] = m;

`i[0][0]` would have the same address as `m[0]`. You'd have a `char` that is
both immutable and mutable.

`scope` is irrelevant, as far as I see.

Closing as invalid. Please reopen if I'm missing something. In particular, if
you think `scope` is relevant, please describe how it makes the conversion
valid.

--


More information about the Digitalmars-d-bugs mailing list