I'm on ubuntu x64 using dmd 2.060 and the following gives an exception:

rdmd --main -unittest -version=useInterface mml/sets.d

while the following runs just fine:

rdmd --main -unittest -version=useAbstractClass mml/sets.d

The exception is:

object.Exception@src/object_.d(108): need opCmp for class mml.sets.ArraySet!(int).ArraySet
----------------
/tmp/.rdmd-1000/rdmd-sets.d-6930C9CC42761331FC9D9AEC14A3F32C/sets(bool mml.sets.Set!(int).Set.add(const(int)).void __ensure(ref const(bool))+0x15) [0x416b25] /tmp/.rdmd-1000/rdmd-sets.d-6930C9CC42761331FC9D9AEC14A3F32C/sets(bool mml.sets.ArraySet!(int).ArraySet.add(const(int))+0xae) [0x416c6e] /tmp/.rdmd-1000/rdmd-sets.d-6930C9CC42761331FC9D9AEC14A3F32C/sets(void mml.sets.__unittest1()+0x30) [0x416aac] /tmp/.rdmd-1000/rdmd-sets.d-6930C9CC42761331FC9D9AEC14A3F32C/sets(void mml.sets.__modtest()+0x9) [0x417051] /tmp/.rdmd-1000/rdmd-sets.d-6930C9CC42761331FC9D9AEC14A3F32C/sets(extern (C) bool core.runtime.runModuleUnitTests().int __foreachbody314(ref object.ModuleInfo*)+0x30) [0x41bc5c] /tmp/.rdmd-1000/rdmd-sets.d-6930C9CC42761331FC9D9AEC14A3F32C/sets(int rt.minfo.moduleinfos_apply(scope int delegate(ref object.ModuleInfo*))+0x55) [0x41a119] /tmp/.rdmd-1000/rdmd-sets.d-6930C9CC42761331FC9D9AEC14A3F32C/sets(runModuleUnitTests+0xae) [0x41bb22] /tmp/.rdmd-1000/rdmd-sets.d-6930C9CC42761331FC9D9AEC14A3F32C/sets(extern (C) int rt.dmain2.main(int, char**).void runAll()+0x22) [0x418f5e] /tmp/.rdmd-1000/rdmd-sets.d-6930C9CC42761331FC9D9AEC14A3F32C/sets(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate())+0x2a) [0x4188aa] /tmp/.rdmd-1000/rdmd-sets.d-6930C9CC42761331FC9D9AEC14A3F32C/sets(main+0xd1) [0x418835] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7fc94ce5276d]

see link for mml/sets.d: http://codepad.org/A9B6WeJH

Why should the fact that I used an interface cause Object.opCmp(Object o) to be called?

Reply via email to