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.
Comment #1 by k.hara.pg — 2012-03-25T23:54:49Z
I think this is just same as bug 3789.
Comment #2 by bugzilla — 2012-03-26T00:37:49Z
In the absense of a user-defined opEquals for the struct, equality is defined as a bitwise compare. This is working as expected. Not a bug.
Comment #3 by bearophile_hugs — 2012-03-26T04:27:27Z
(In reply to comment #2)
> In the absense of a user-defined opEquals for the struct, equality is defined
> as a bitwise compare. This is working as expected. Not a bug.
See my answer in Bug 3789 .