I just made a startling discovery: the old operator overload routines still work in 2.045

Is this intended?


struct S
{
    int x;
    S opAddAssign(ref const S other)
    {
        x += other.x;
        return this;
    }
}

void foo(S s)
{
    s += s;
}

generates no error.

And in fact, neither does this:


struct S
{
    int x;
    S opAddAssign(ref const S other)
    {
        x += other.x;
        return this;
    }

    S opOpAssign(string op)(ref const S other) if (op == "+=")
    {
        static assert(0, "fail!");
    }
}

void foo(S s)
{
    s += s;
}

But if I only have the template version, it does use the template.

-Steve

Reply via email to