Thread overview
[Issue 7658] New: [CTFE] assignment to reference in foreach fails without error message
Mar 07, 2012
aneas
Oct 08, 2012
SHOO
Nov 02, 2012
yebblies
March 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7658

           Summary: [CTFE] assignment to reference in foreach fails
                    without error message
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: CTFE
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: aneas@gmx.net


--- Comment #0 from aneas <aneas@gmx.net> 2012-03-07 02:13:42 PST ---
string foo() {
    string[] children = ["0"];
    foreach(ref child; children)
        child = "1";
    return children[0];
}

void main() {
    static assert(foo() == "0");
    assert(foo() == "1");
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 08, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7658


SHOO <zan77137@nifty.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zan77137@nifty.com


--- Comment #1 from SHOO <zan77137@nifty.com> 2012-10-08 07:41:36 PDT ---
*** Issue 8773 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7658


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies@gmail.com
         Resolution|                            |FIXED


--- Comment #2 from yebblies <yebblies@gmail.com> 2012-11-02 17:59:10 EST ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/b52dca5a53def60352dbcbf4f398c10abb2cb6b1 Fix issue 8498 modifying foreach range iterator fails in CTFE

This was caused by ignoring assignment to ref variables. (These guys can only be created by the inliner, or by lowering, such as happens in foreach).

Also fixes bug 7658: assignment to ref in foreach.
Also fixes bug 8539: nested functions, ref parameter, -inline.

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