Thread overview
[Issue 1671] New: associative array comparison fails
Nov 15, 2007
d-bugmail
Apr 24, 2009
d-bugmail
May 31, 2010
Don
November 15, 2007
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


-- 

November 15, 2007
<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.


April 24, 2009
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


-- 

May 31, 2010
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: -------