Getting with below error for following codes. Look like bug?
onlineapp.d(61): Error: scope variable `a` assigned to non-scope parameter `a` calling `foo`

    @safe:

    struct A(S = string)
    {
    @safe:
        S s;
        void delegate() c;
    }

    struct B(S = string)
    {
    @safe:
        @disable this();

        this(C!S c, A!S a)
        {
            this.c = c;
            this.a = a;
        }

        C!S foo()
        {
            return c;
        }

        A!S a;
        C!S c;
    }

    class C(S = string)
    {
    @safe:
        C!S foo(A!S a)
        {
            auto o = new Object();
            return foo2(o, a);
        }

        C!S foo2(Object n, A!S a)
        {
            auto b = B!S(this, a);
                return b.foo();
        }
    }

    unittest
    {
        static struct X
        {
        @safe:
                void foo3()
                {
                }
        }

        X x;
        A!string a;
        a.s = "foo";
        a.c = &x.foo3;
        auto c = new C!string();
        c.foo(a);
    }

void main()
{
}

Reply via email to