Hello

How to make this code to compile? My goal is safe(not @trusted) longFunction().


---
class C
{
    override bool opEquals(Object o) const @safe
    {
        return true;
    }
}
bool longFunction(C a, C b) @safe
{
    return a==b;
}
void main()
{
}
---


As far as I understand the problem is that AST for this code looks like

---
import object;
class C : Object
{
        override const @safe bool opEquals(Object o)
        {
                return true;
        }
}
bool longFunction(C a, C b)
{
        return opEquals(a, b);
}
void main()
{
        return 0;
}
RTInfo!(C)
{
        enum typeof(null) RTInfo = null;

}
---

and object.opEquals(a,b) do not inherits safety from class C properties, and also I can't override it.

Is there clean way to use '==' here, or I have to convert this to a.opEquals(b) for classes, leaving '==' for structs?

Thanks!

Reply via email to