With this class definition, class C { static int count; override bool opEquals(Object rhs) { ++count; return true; } } Mutable object comparison calls C.opEquals once. This is expected. C.count = 0; auto mc1 = new C; auto mc2 = new C; assert(mc1 == mc2); assert(C.count == 1); But, in shared object comparison, C.count = 0; auto sc1 = new shared C; auto sc2 = new shared C; assert(sc1 == sc2); // compiles... why? assert(C.count == 1); Mutable opEquals is still called. This is bad hehavior. Moreover, there is another inconsistency. auto so1 = new shared Object; auto so2 = new shared Object; assert(so1 == so2); // fail to compile If you directly compare shared Object class, it fails to compile correctly.
The shared version of equality comparison does not work today. Closing as fixed.