[Issue 24175] DIP1000 fails to determine proper lifetime for struct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 6 17:49:59 UTC 2023


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

Max Samukha <maxsamukha at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxsamukha at gmail.com

--- Comment #3 from Max Samukha <maxsamukha at gmail.com> ---
(In reply to Grim Maple from comment #2)
> I don't understand how this is invalid, when the code I wrote is completely
> valid, doesn't escape references, yet is marked as "escaping references"

The problem is separate compilation/lack of lifetime inference:

struct A
{
    this(int[] data) @safe;
    int[] a;
}

Now, compiler doesn't know whether the constructor stores the argument in a
location outliving 'this'. People are busy trying to be compatible with
stone-age technologies, so it's unlikely to change.

--


More information about the Digitalmars-d-bugs mailing list