digitalmars.D.bugs - [Issue 12108] New: Array comparison throws 'TypeInfo.equals is not implemented'
- d-bugmail puremagic.com (38/38) Feb 08 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12108
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 puremagic.com ReportedBy: stanislav.blinov gmail.com 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: -------
Feb 08 2014