Fatal bug involving opApply and const in templates

Janice Caron caron800 at googlemail.com
Wed Nov 28 14:58:29 PST 2007


Fatal bug. The following code causes the DMD 2.007 compiler to crash on Windows.

struct A(T)
{
    T[] a;

    int opApply(int delegate(ref T) dg)
    {
        foreach(ref v;a)
        {
            int n = dg(v);
            if (n != 0) return n;
        }
        return 0;
    }
};

void main()
{
    A!(const(float)) a;
}


More information about the Digitalmars-d-bugs mailing list