www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7790] New: [CTFE] assignment to AA apply ref argument

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7790

           Summary: [CTFE] assignment to AA apply ref argument
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: dawg dawgfoto.de



struct Symbol
{
    size_t _id;
}

size_t foo(Symbol[string] tree)
{
    size_t i;
    foreach(k, ref v; tree)
        v._id = ++i; // has no effect
    return tree["a"]._id;
}

static assert(foo(["a":Symbol(0)]) == 1);

--------

The assignment to the ref value field has no effect.
Looks like the value literal is copied before calling the
foreach body.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 28 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7790


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, wrong-code



https://github.com/D-Programming-Language/dmd/pull/1351

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 05 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7790




Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/93a019d5b10dc0fdc207912d8311a7498bad0e6b
Fix issue 7790 [CTFE] assignment to AA apply ref argument

1. IndexExp: Stop copying the AA whenever it is indexed (This was horrific for
performance, as well as being wrong).
2. aaApply: If the value is 'ref', create a reference to the value.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 06 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7790


dawg dawgfoto.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 06 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7790




Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/c42dcec4f053ffa65feb278d09efb701fabc6fa0
Fix issue 7790 [CTFE] assignment to AA apply ref argument

1. IndexExp: Stop copying the AA whenever it is indexed (This was horrific for
performance, as well as being wrong).
2. aaApply: If the value is 'ref', create a reference to the value.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 18 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7790


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com
            Version|D2                          |D1 & D2



11:32:20 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1908

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