This came up in the forum: https://forum.dlang.org/post/r1lkbt$2vmk$1@digitalmars.com As far as I can tell, this can be allowed without compromising safety: ---- void main() @safe { static struct S { int value; int* pointer; } /* explicit `scope`: */ scope S s1; scope int* p1 = &s1.value; /* Error: cannot take address of scope local */ /* inferred `scope`: */ int x; S s2 = S(0, &x); int* p2 = &s2.value; /* Error: cannot take address of scope local */ } ---- The `scope` on `s1` and `s2` really just applies to the `pointer` field. It can be ignored for the `value` field.
@aG0aep6G created dlang/dmd pull request #10773 "fix issue 20569 - [DIP1000] allow taking the address of a `scope` str…" fixing this issue: - fix issue 20569 - [DIP1000] allow taking the address of a `scope` struct field if it has no indirections https://github.com/dlang/dmd/pull/10773
dlang/dmd pull request #10773 "fix issue 20569 - [DIP1000] allow taking the address of a `scope` str…" was merged into master: - c1a9253d649353931b47a4577ba1295119e67028 by aG0aep6G: fix issue 20569 - [DIP1000] allow taking the address of a `scope` struct field if it has no indirections https://github.com/dlang/dmd/pull/10773