std.string.assumeUTF() silently casting mutable to immutable?

Forest forest at example.com
Wed Feb 14 11:56:29 UTC 2024


On Wednesday, 14 February 2024 at 10:57:42 UTC, RazvanN wrote:
>
> This has already been fixed, you just need to use 
> -preview=fixImmutableConv. This was put behind a preview flag 
> as it introduces a breaking change.

I just tried that flag on run.dlang.org, and although it fixes 
the case I posted earlier, it doesn't fix this one:

```d
string test(const(ubyte)[] arr)
{
     import std.string;
     return arr.assumeUTF;
}
```

Shouldn't this be rejected as well?


More information about the Digitalmars-d-learn mailing list