www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6775] New: [CTFE] foreach over an AA fails

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

           Summary: [CTFE] foreach over an AA fails
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: clugdbug yahoo.com.au


--- Comment #0 from Don <clugdbug yahoo.com.au> 2011-10-05 22:40:40 PDT ---
..because aaApply and aaApply2 aren't implemented.

Simple test case:

static assert({
    int[int] aa = [58: 17, 45:6];
    int valsum = 0;
    int keysum = 0;
    foreach(m; aa) { //aaApply
        valsum += m;
    }
    assert(valsum == 17+6);
    valsum = 0;
    foreach(n, m; aa) { //aaApply2
        valsum += m;
        keysum += n;
    }
    assert(valsum == 17+6);
    assert(keysum == 58+45);
    // Check empty AA
    valsum = 0;
    int[int] bb;
    foreach(m; bb) {
        ++valsum;
    }
    assert(valsum == 0);
    return true;
}());

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 05 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6775


Walter Bright <bugzilla digitalmars.com> changed:

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


--- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2011-10-06
23:30:08 PDT ---
https://github.com/D-Programming-Language/dmd/commit/61ea0ca9cc8a0220830318bc1b66f0788db65818

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

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