[Issue 12108] New: Array comparison throws 'TypeInfo.equals is not implemented'
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Feb 8 08:14:12 PST 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12108
Summary: Array comparison throws 'TypeInfo.equals is not
implemented'
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: druntime
AssignedTo: nobody at puremagic.com
ReportedBy: stanislav.blinov at gmail.com
--- Comment #0 from Stanislav Blinov <stanislav.blinov at gmail.com> 2014-02-08 08:14:08 PST ---
When struct's member field's type has non-const opEquals defined, comparing
arrays of these structs throws an exception with not very helpful error
message.
struct A {
bool opEquals(A s) { return false; }
}
struct B {
A a;
}
void main(){
A a1, a2;
if (a1 == a2) {} //ok
if ([a1] == [a2]) {} //ok
B b1, b2;
if (b1 == b2) {} //ok
if ([b1] == [b2]) {} // throws object.Error: TypeInfo.equals is not
implemented
}
Making opEquals const gets rid of the exception.
It's not clear why it happens at runtime as opposed to compile time, and the
message doesn't really explain what's going on.
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list