[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 01:59:11 UTC 2021


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

Paul Backus <snarwin+bugzilla at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |snarwin+bugzilla at gmail.com

--- Comment #2 from Paul Backus <snarwin+bugzilla at gmail.com> ---
If `bb` and the constructor are marked as @safe, DMD produces the following
error:

---
Error: reference to stack allocated value returned by bb() assigned to
non-scope this.str
---

Separately from this, compiling with `-preview=dip1000` causes DMD to produce
the following error:

---
Error: cannot implicitly convert expression bb() of type char[12] to string
---

--


More information about the Digitalmars-d-bugs mailing list