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

[email protected] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #1 from [email protected] ---
I think this is invalid. `t.add` and `s.add` are parentheses-less calls. So the
error about T.add not being callable "using argument types ()" is correct. To
get a delegate, add '&':

struct S {
    int i;
    T t;

    auto add(int a) {
        t.i = a + i;
        return &t.add; /* ! */
    }
}

struct T {
    int i;
    int add(int a) {
        return i + a;
    }
}

int main() {
    S s;
    s.i = s.t.i = 1;
    auto dg1 = &s.add; /* ! */
    auto dg2 = dg1(34);
    return dg2(7);
}

--

Reply via email to