www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1671] New: associative array comparison fails

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

           Summary: associative array comparison fails
           Product: D
           Version: 1.023
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: diggory.hardy gmail.com


The final assertion in the following code fails:

    char[][char] X = ['a':cast(char[])"animal", 'b':['b','u','s']];
    char[][char] Y = ['a':cast(char[])"animal", 'b':['b','u','s']];
    assert (X.length == Y.length);
    assert (X.keys == Y.keys);
    assert (X.values == Y.values);
    //X.rehash; Y.rehash;       // doesn't make a difference
    assert (X == Y);            // fails


-- 
Nov 15 2007
next sibling parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
<d-bugmail puremagic.com> wrote in message 
news:bug-1671-3 http.d.puremagic.com/issues/...
 http://d.puremagic.com/issues/show_bug.cgi?id=1671

           Summary: associative array comparison fails
           Product: D
           Version: 1.023
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: diggory.hardy gmail.com


 The final assertion in the following code fails:

    char[][char] X = ['a':cast(char[])"animal", 'b':['b','u','s']];
    char[][char] Y = ['a':cast(char[])"animal", 'b':['b','u','s']];
    assert (X.length == Y.length);
    assert (X.keys == Y.keys);
    assert (X.values == Y.values);
    //X.rehash; Y.rehash;       // doesn't make a difference
    assert (X == Y);            // fails


 -- 

Is AA comparison defined as the two AAs as having the same key-value pairs? I don't know if it's defined at all. I think == in the current implementation just sees if the two AA references point to the same AA.
Nov 15 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1671





------- Comment #1 from cbkbbejeap mailinator.com  2009-04-23 22:52 -------
Simpler example:

assert([1:1] == [1:1]); // Fails


-- 
Apr 23 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1671


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |FIXED


--- Comment #2 from Don <clugdbug yahoo.com.au> 2010-05-31 12:03:52 PDT ---
Fixed DMD 1.057 and 2.041.

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