Segfault upon modifying immutable AA in static this

"Nordlöw" via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jan 24 05:24:01 PST 2015


This snippet

     static immutable words = [ `zero`, `one`, `two` ];

     static immutable ubyte[string] wordsAA;

     static this()
     {
         foreach (ubyte i, e; words) { wordsAA[e] = i; }
     }

compiles and links on dmd git master but run segfaults.

Removing immutable qualifier from wordsAA avoids the segfeault.

Are static module ctors allowed to modify immutable data or this 
a DMD bug?


More information about the Digitalmars-d-learn mailing list