On Friday, 4 February 2022 at 15:58:19 UTC, Stanislav Blinov wrote:

..
...
As others have already stated, casting immutability away is something that has to be supported, e.g. to interface with const-agnostic APIs. `@safe` requires such casts to be more verbose, with good reason.

I concede ;-)

That the compiler knows this is @safe:
cast(char[])iStr.dup;

and this is not @safe:
cast(char[])iStr;

is sufficent.

Reply via email to