I came across an issue recently that I’m a little confused by. The following program fails to compile under LDC and DMD, though it compiles fine under GDC:

    @nogc:

    void main()
    {
        static foreach(i; 0 .. 4)
        {
            pragma(msg, i);
        }
    }

Both DMD and LDC report the following error if I try to compile it:

test.d(7): Error: cannot use operator ~= in @nogc delegate test.main.__lambda1

I was just wondering, is this is a compiler bug or is there a reason I'm overlooking preventing this sort of code from compiling?

Reply via email to