Thread overview
[Issue 24394] mutable array can be returned as string
Feb 14
RazvanN
Feb 14
Forest
[Issue 24394] const(ubyte)[] array can be returned as string
Feb 14
Forest
Feb 14
Forest
[Issue 24394] const(ubyte)[] array argument can be returned as string, mislabeling mutable data as immutable
Feb 24
Forest
February 14
https://issues.dlang.org/show_bug.cgi?id=24394

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305@gmail.com
         Resolution|---                         |FIXED

--- Comment #1 from RazvanN <razvan.nitu1305@gmail.com> ---
This is fixed in master but the fix is behind a preview switch
(-preview=fixImmutableConv).

--
February 14
https://issues.dlang.org/show_bug.cgi?id=24394

--- Comment #2 from Forest <forestix@nom.one> ---
The above example does indeed trigger an error with -preview=fixImmutableConv on run.dlang.org. However, changing the test function's argument to const(ubyte)[] slips right past with no complaint.

Shouldn't that be rejected as well?


string test(const(ubyte)[] arr)
{
    import std.string;
    return arr.assumeUTF; // why does this compile?
}

--
February 14
https://issues.dlang.org/show_bug.cgi?id=24394

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |safe
                 CC|                            |nick@geany.org

--
February 14
https://issues.dlang.org/show_bug.cgi?id=24394

Forest <forestix@nom.one> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---
            Summary|mutable array can be        |const(ubyte)[] array can be
                   |returned as string          |returned as string

--
February 14
https://issues.dlang.org/show_bug.cgi?id=24394

Forest <forestix@nom.one> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|Windows                     |All

--
February 24
https://issues.dlang.org/show_bug.cgi?id=24394

Forest <forestix@nom.one> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|const(ubyte)[] array can be |const(ubyte)[] array
                   |returned as string          |argument can be returned as
                   |                            |string, mislabeling mutable
                   |                            |data as immutable

--