Thread overview
[Issue 3456] New: ref foreach over array in CTFE silently fails.
Oct 30, 2009
David Simcha
Nov 02, 2009
Don
Dec 29, 2009
Don
October 30, 2009
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: nobody@puremagic.com
        ReportedBy: dsimcha@yahoo.com


--- Comment #0 from David Simcha <dsimcha@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: -------
November 02, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3456



--- Comment #1 from Don <clugdbug@yahoo.com.au> 2009-11-02 04:58:07 PST ---
This is a duplicate of bug 1330.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 29, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3456


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug@yahoo.com.au
         Resolution|                            |DUPLICATE


--- Comment #2 from Don <clugdbug@yahoo.com.au> 2009-12-29 00:12:38 PST ---
*** This issue has been marked as a duplicate of issue 1330 ***

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