[Issue 20674] [DIP1000] inference of `scope` is easily confused

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun May 9 20:49:15 UTC 2021


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

Paul Backus <snarwin+bugzilla at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |snarwin+bugzilla at gmail.com

--- Comment #2 from Paul Backus <snarwin+bugzilla at gmail.com> ---
Note that this can be worked around by explicitly declaring the local variable
in the second example `scope`:

---
int* f()(int* p)
{
    static int g;
    g = 0;
    scope p2 = p; /* the only difference */
    return new int;
}

int* g() @safe
{
    int x;
    return f(&x); /* ok */
}
---

--


More information about the Digitalmars-d-bugs mailing list