UFCS and delegates

Steve Teale steve.teale at britseyeview.com
Sat Mar 15 01:33:12 PDT 2014


Doesn't the logic of UFCS rather suggest that this should compile?

struct A
{
    int m;
    void foo(int n) { m += n; }
}

void bar(ref A a, int n)
{
    a.foo(n*n);
}

void delegate(int) dg = &bar;

void main()
{
    A a;
    a.bar(3);
    dg(3);
    assert(a.m == 18);
}


More information about the Digitalmars-d mailing list