www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Fatal bug involving opApply and const in templates

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;
}
Nov 28 2007