[Issue 7342] New: structs don't call the right opEquals on contained arrays
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Jan 21 15:52:26 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7342
Summary: structs don't call the right opEquals on contained
arrays
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Severity: major
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2012-01-21 15:52:25 PST ---
This assert fires, but this is wrong:
const struct Foo { int[] a; }
void main() {
Foo f1 = Foo([1, 2]);
Foo f2 = Foo([1] ~ 2);
assert(f1 !is f2); // OK
assert(f1 == f2); // AssertError
}
It's a source of bugs, like:
import std.stdio;
const struct Foo { int[] a; }
void main() {
int[const Foo] aa;
aa[Foo([1, 2])] = 1;
aa[Foo([1] ~ [2])] = 2;
writeln(aa);
}
[const(Foo)([1, 2]):1, const(Foo)([1, 2]):2]
Please fix this. I have set the "major" Severity (almost "Critical") because
this causes some of the worst bugs I have had in single-threaded D code.
--
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