[Issue 6812] New: Failed equality of structs with string field
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Oct 13 11:56:36 PDT 2011
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: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 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 at 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: -------
More information about the Digitalmars-d-bugs
mailing list