The code below doesn't work. Is it possible to make a pure opEquals in a class? void main() { class A { bool a; int b; this(bool g, int h) { a = g; b = h; } pure bool opEquals(const A rhs) const { return b == rhs.b; } } A a = new A(true, 5); A b = new A(false, 5); assert(a == b); //fails }