[Issue 21197] Wrong lifetime inference with DIP1000 in dmd 2.093.0
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Aug 11 02:16:17 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=21197
--- Comment #4 from Walter Bright <bugzilla at digitalmars.com> ---
A better test case, with and without the error message:
@safe void check2() {
int random;
S create1() { return S(); }
scope S gen1 = create1; // no error
S create2() { return S(&random); }
// address of struct temporary returned by `create()` assigned to longer
lived variable `gen`
scope S gen2 = create2;
}
struct S { int* r; }
--
More information about the Digitalmars-d-bugs
mailing list