Fatal bug involving opApply and const in templates

Brad Roberts braddr at puremagic.com
Wed Nov 28 17:24:51 PST 2007


On Wed, 28 Nov 2007, Janice Caron wrote:

> 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;
> }

http://d.puremagic.com/issues/ -- please file it after testing with 2.008.  
Enough with const changed that it's entirely possible the bug doesn't 
exist any more already.

Later,
Brad


More information about the Digitalmars-d-bugs mailing list