[Issue 21807] Non-immutable data can be converted to immutable using function call in ctor

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 7 19:31:14 UTC 2021


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

--- Comment #6 from Paul Backus <snarwin+bugzilla at gmail.com> ---
(In reply to anonymous4 from comment #5)
> char[] a(const int[] arr) pure @safe;
> void b(const int[] arr) @safe
> {
>     char[] c=a(arr);
>     string d=a(arr);
> }
> 
> For this code dip1000 rejects the conversion to string too. How is it
> related to dip1000?

It's not related to dip1000. Passing `-preview=dip1000` causes a different code
path to be taken in the compiler, which ends up avoiding this bug by
coincidence.

--


More information about the Digitalmars-d-bugs mailing list