On Tuesday, 13 May 2025 at 11:55:21 UTC, matheus wrote:
Unfortunately adding the pointer gives me another error:
I added @safe: and replaced `const` with `auto` because casting away const isn't safe. This should do it:
```D // compile with -preview=dip1000 import std; @safe: struct S { int* p; } void f(ref scope S ctx) { auto old = ctx; g(ctx); ctx = old; } void g(ref scope S ctx) { S a; ctx = a; } void main() { S i; f(i); } ```