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

Walter Bright <[email protected]> changed:

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

--- Comment #3 from Walter Bright <[email protected]> ---
// Attachment 1368 is small enough to inline here:

alias Action = void delegate();

class A
{
    invariant()
    {
    }

    public Action foo(Action a)
    {
        synchronized
        {
            B elements = new B;
            Action[] actions = [a];

            elements.bar(actions);

            if (actions.length > 1)
                elements.bar(actions);
            return actions[0];
        }
        return null;
    }
}

class B
{
    public bool bar(ref Action[])
    {
        return false;
    }
}

class D
{
    void baz()
    {
    }
}

void main()
{
    auto a = new A;
    auto d = new D;

    assert(a.foo(&d.baz) == &d.baz);
}

--

Reply via email to