www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9375] New: wrong code when assigning to ref in CTFE

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

           Summary: wrong code when assigning to ref in CTFE
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: CTFE, wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: nilsbossung googlemail.com


--- Comment #0 from Nils <nilsbossung googlemail.com> 2013-01-22 18:13:41 PST
---
Related to issue 7887. While 7887 ICEs, this one compiles, but produces wrong
values.

ref r(ref int[][] a) {
    return a[0];
}
auto go() {
    int[][] a = [[]];
    r(a) = [42];
    return a;
}
void main() {
    enum ct = go();
    auto rt = go();
    assert(ct == rt); // fails
}

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