http://d.puremagic.com/issues/show_bug.cgi?id=6812
Summary: Failed equality of structs with string field
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Keywords: wrong-code
Severity: normal
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from [email protected] 2011-10-13 11:55:44 PDT ---
This program produces a runtime assert error, it's a bug:
struct Foo {
string s;
}
void main() {
Foo b1 = Foo("hello".idup);
Foo b2 = Foo("hello".idup);
assert(b1 !is b2); // OK
assert(b1 == b2); // line 8, error
}
With DMD 2.056head it gives:
core.exception.AssertError@test(8): Assertion failure
The equality among structs has to call the string equality of their fields. The
"is" operator has to compare the structs bitwise.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------