This code belown can be compiled with DMD 2.050. However, it throws an error 
message: 
core.exception.HiddenFuncError: Hidden method called for main.AClass

I'm not sure about whether it is a bug. Thanks for any help.
 


import std.stdio;

class AClass
{
    int data;

// It's wrong
    bool opEquals(AClass a)
    {
        writefln("running here.");
        return data == a.data;
    }

// It works
//    bool opEquals(Object a)
//    {
//        writefln("running here.");
//        return data == (cast(AClass)a).data;
//    }

}


int main(string[] args)
{

    AClass class1 = new AClass();
    AClass class2 = new AClass();

    if(class1 == class2)
        writefln("==");
    else
        writefln("!=");

    return 0;
}

----------
Zhang <bitwo...@qq.com>

s

Reply via email to