https://issues.dlang.org/show_bug.cgi?id=22977
--- Comment #3 from Walter Bright <[email protected]> --- Interestingly, if `scope return` is added to `fn()`: int* gPtr; void main() @safe { scope int* sPtr; int* fn() scope return { return sPtr; } gPtr = fn(); } The correct error is generated: Error: reference to stack allocated value returned by `fn()` assigned to non-scope `gPtr` --
