Test program: import std.stdio; char[] ctfeFun() { char[] stuff = "This is clearly a bug.".dup; foreach(ref c; stuff) { c = 'X'; } return stuff; } const compileTimeResult = ctfeFun(); void main() { writeln("Compile time: ", compileTimeResult); writeln("Run time: ", ctfeFun()); } Output: Compile time: This is clearly a bug. Run time: XXXXXXXXXXXXXXXXXXXXXX Marking as severe because, IMHO, anything that silently results in subtly defective code being generated is pretty serious. If this can't be easily fixed, then it should be an error.
This is a duplicate of bug 1330.
*** This issue has been marked as a duplicate of issue 1330 ***