strtr wrote: > On winXP (D1) I can compile/run this code without a problem. > Not even a warning. > > void main() { > char[] s= "immutable literal?"; > s[$-1] = '!'; > writefln(s); > } > Codepad runs into a segmentation fault. > http://codepad.org/NQfsRoR5 > > Why doesn't it result in a compiler error or warning? > If it did I would have noticed this quirk earlier.
There's no compiler error because D1 doesn't have a const/immutable system. There's no crash because Windows doesn't write-protect the data segment which contains the literal.