[Issue 21197] Wrong lifetime inference with DIP1000 in dmd 2.093.0

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 28 08:20:56 UTC 2022


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

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at digitalmars.com

--- Comment #3 from Walter Bright <bugzilla at digitalmars.com> ---
If we replace the struct with an equivalent pointer:

@safe void check()
{
    int random;

    auto createGenerator() {
        int* p = &random;
        return p;
    }

    scope gen = createGenerator;
}

it does compile successfully. Both should compile successfully, as the struct
is just a wrapper around a pointer.

--


More information about the Digitalmars-d-bugs mailing list