digitalmars.D.bugs - [Issue 6812] New: Failed equality of structs with string field
- d-bugmail puremagic.com (31/31) Oct 13 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6812
- d-bugmail puremagic.com (25/25) Oct 13 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6812
- d-bugmail puremagic.com (10/10) Oct 13 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6812
- d-bugmail puremagic.com (11/11) Oct 13 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6812
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 puremagic.com ReportedBy: bearophile_hugs eml.cc --- Comment #0 from bearophile_hugs 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 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: -------
Oct 13 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6812 --- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2011-10-13 17:53:17 PDT --- Class type has same problem. struct Foo { string s; } struct Bar { static class X { bool opEquals(Object o){ return true; } } X x; } void main() { Foo f1 = Foo("hello".idup); Foo f2 = Foo("hello".idup); assert(f1 !is f2); // OK assert(f1 == f2); // error Bar b1 = Bar(new Bar.X()); Bar b2 = Bar(new Bar.X()); assert(b1 !is b2); // OK assert(b1 == b2); // error! } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 13 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6812 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug yahoo.com.au --- Comment #2 from Don <clugdbug yahoo.com.au> 2011-10-13 23:10:37 PDT --- Looks like a dup of bug 3789 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 13 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6812 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE --- Comment #3 from Kenji Hara <k.hara.pg gmail.com> 2011-10-13 23:22:29 PDT --- *** This issue has been marked as a duplicate of issue 3789 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 13 2011