cat > bug.d << CODE extern (C++) class RootObject { bool equals(RootObject o) { return o is this; } int compare(RootObject) { assert(0); } void print() { assert(0, "Should not get called"); } } void main() { bool[RootObject] aa; aa[new RootObject] = true; } CODE ---- dmd -run bug ---- Because TypeInfo_Class casts every void* to a standard Object, it ends up calling the wrong vtable entries for operations like getHash. I think we need a dedicated TypeInfo_CppClass that is similar to TypeInfo_Struct with it's xopEquals and xopHash in order to fix this bug. C++ classes don't inherit from the common Object class, so those methods must not exist.
Marking of duplicate of 15813 since this issue is the more "user-facing" bug. *** This issue has been marked as a duplicate of issue 15813 ***