Compiler bug ?

Temtaime temtaime at gmail.com
Fri May 17 07:01:18 PDT 2013


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.


More information about the Digitalmars-d-learn mailing list