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

--- Comment #22 from Tomer Filiba (weka) <to...@weka.io> ---
void delegate() callback;

struct S {
    int x;
    @disable this(this);

    this(int x) {
        this.x = x;
        callback = &inc;
    }
    void inc() {
        x++;
    }
}

auto f() {
    return g();
}
auto g() {
    return h();
}
auto h() {
    return S(100);
}

void main() {
    auto s = f();
    writeln(&s, " ", callback.ptr);    // 7FFF0C838400 7FFF0C8383A0
    callback();
    writeln(s.x);                      // 100 instead of 101
}

--

Reply via email to