Thread overview
[Issue 7783] New: compiler generated struct equality doesn't compare array fields
Mar 26, 2012
dawg@dawgfoto.de
Mar 26, 2012
Kenji Hara
Mar 26, 2012
dawg@dawgfoto.de
March 26, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7783

           Summary: compiler generated struct equality doesn't compare
                    array fields
           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


--- Comment #0 from dawg@dawgfoto.de 2012-03-25 22:10:53 PDT ---
cat > bug.d << CODE
struct Foo
{
    string name;
    bool b;
}

void main()
{
    auto a = Foo("foobar".idup, true);
    auto b = Foo("foobar".idup, true);
    assert(a == b);
}
CODE

dmd -run bug

--------

The structures are compared bitwise which fails here.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 26, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7783



--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-03-25 23:54:49 PDT ---
I think this is just same as bug 3789.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 26, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7783



--- Comment #4 from dawg@dawgfoto.de 2012-03-26 13:38:49 PDT ---
I didn't found the specs. http://dlang.org/expression.html#EqualExpression

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