What is Ordinal defined as? If it's a uint, I get the expected results: alias uint Ordinal;
struct Lexeme { string tag; string slice; Ordinal index; } void main() { auto lex1 = Lexeme("a","b",1); auto lex2 = Lexeme("a","b",1); assert(lex1 == lex2); assert(lex1 == Lexeme("a","b",1)); } Can't say much more without knowing what your app does though.