[Issue 17049] [scope] class references are not escape checked like pointers

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Feb 24 14:47:07 PST 2017


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

--- Comment #6 from Martin Nowak <code at dawg.eu> ---
And the same is supposed to work for foreign pointers?

static @safe float* get2(return ref scope S _this)
{
    return convert(&_this);
}

@trusted float* convert(S* s) { return cast(float*)s; }

struct S
{
}

float* escape() @safe
{
    S s;
    auto pf = s.get2();
    return pf; // works
}
----
Error: scope variable pf may not be returned
----

--


More information about the Digitalmars-d-bugs mailing list