Thread overview
[Issue 6751] New: [CTFE] ref argument of AA doesn't work
Oct 01, 2011
Hisayuki Mima
Oct 02, 2011
Don
Oct 04, 2011
Walter Bright
October 01, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6751

           Summary: [CTFE] ref argument of AA doesn't work
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: youxkei@gmail.com


--- Comment #0 from Hisayuki Mima <youxkei@gmail.com> 2011-10-02 01:00:53 JST ---
void f(ref int i, ref string str, ref int[int] aa){
    i = 2;
    str ~= "hello";
    aa[1] = 2;
    assert(aa[1] == 2);
}

static assert({
    int[int] aa;
    int i;
    string str;
    f(i, str, aa);
    assert(i == 2);// OK
    assert(str == "hello");// OK
    assert(aa[1] == 2);// Error: cannot index null array aa
}());

The above code doesn't be compiled by the dmd v2.056 DEBUG built from github
after the commit 42fea4c1f2.
This means that ref argument of AA doesn't work well in CTFE.

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug@yahoo.com.au


--- Comment #1 from Don <clugdbug@yahoo.com.au> 2011-10-02 13:29:35 PDT ---
This bug only applies in the case where the AA is null, at the moment when it is passed by reference.

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


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2011-10-04 16:39:25 PDT ---
https://github.com/D-Programming-Language/dmd/commit/51d83859ec2440f90ca1625640358502372b1465

https://github.com/D-Programming-Language/dmd/commit/411fdb0f7b391a028d40ec888b63d44ebcb646bb

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