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

--- Comment #4 from João Lourenço <[email protected]> ---
So, how can I achieve something like this while instantiating a class or struct
with scope in @safe code?

---
struct Bar
{
    int[] somePointerToRestrictThis;

    @safe Wrapper dummy() return scope {
        Wrapper wrapper = { bar: &this };
        return wrapper;
    }
}

struct Wrapper
{
        Bar* bar;
}

@safe
void main()
{
    scope bar = Bar();
    cast(void) bar.dummy;
}
---

--

Reply via email to