struct A {
        int opBinary(string op)(A) { k++; return 0; }
}

struct B {
        A __a;
        alias __a this;
}

void main() {
    B b;
    auto c = b * b;
}


This code doesn't compiles with an error:
Error: 'b' is not of arithmetic type, it is a B

If i remove k++, then it's OK. It seems that compiler omitting the function if there an error in it.

Reply via email to