https://issues.dlang.org/show_bug.cgi?id=24208

--- Comment #2 from Paul Backus <[email protected]> ---
...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(&n); // no error
    escape2(&n); // error
    escape3(&n); // 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`.

--

Reply via email to