Hello,
Why does expression 'foo = bars[][0].foo' work but 'foo = bars[].front.foo' doesn't?

example:


class Foo{}

struct Bar{
        Foo foo;
}

void main()@safe{
        import std;

    Foo foo;
    scope Bar[] bars = [Bar.init];

    foo = bars[][0].foo;                //OK, WHY?
foo = bars[].front.foo; //Error: scope variable bars assigned to foo with longer lifetime
}

Reply via email to