http://d.puremagic.com/issues/show_bug.cgi?id=3456

           Summary: ref foreach over array in CTFE silently fails.
           Product: D
           Version: 2.035
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic, wrong-code
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: dsim...@yahoo.com


--- Comment #0 from David Simcha <dsim...@yahoo.com> 2009-10-30 11:25:48 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to