https://issues.dlang.org/show_bug.cgi?id=23445
--- Comment #6 from timon.g...@gmx.ch --- The delegate context is allocated on the heap. There is a `scope int* p` in that context, and this pointer points to the stack variable `x`. `qux` uses `foo` to escape a pointer to the local stack variable `x`. The delegate context is not even being referenced anymore when the UB happens. `foo` is just a device that allows `scope`-laundering an arbitrary pointer. `scope` pointer in, non-`scope` pointer out. --