[Issue 24208] [DIP1000] Nested function can escape scope parameter
https://issues.dlang.org/show_bug.cgi?id=24208 --- Comment #3 from Paul Backus --- Disregard previous example, I read the errors wrong. They occur in the function bodies, not at the call site. The parameter of `escape` is not allowed to escape at all if it is `scope`, even `return scope`. --
[Issue 24208] [DIP1000] Nested function can escape scope parameter
https://issues.dlang.org/show_bug.cgi?id=24208 --- Comment #2 from Paul Backus --- ...or maybe the problem is that it's being incorrectly inferred as `scope` instead of `return scope`. Another example: --- void main() @safe { int* escaped; void escape1(int* p) @safe { escaped = p; } void escape2(scope int* p) @safe { escaped = p; } void escape3(return scope int* p) @safe { escaped = p; } int n; escape1(); // no error escape2(); // error escape3(); // error } --- It's hard to tell what attributes the compiler is inferring here, but the observed behavior is consistent with the hypothesis that `scope int* p` is being inferred for `escape1`, and `return scope int* p` is being inferred for both `escape2` and `escape3`. --
[Issue 24208] [DIP1000] Nested function can escape scope parameter
https://issues.dlang.org/show_bug.cgi?id=24208 Paul Backus changed: What|Removed |Added Summary|[DIP1000] Nested function |[DIP1000] Nested function |can pass scope pointer to |can escape scope parameter |non-scope parameter | --