www.digitalmars.com         C & C++   DMDScript  

D - using cast() implicitly

imho this is unobvious error:

int main(char[][] args) {
T a = new T();
T b = new T();

T c = a+b;	// good
c = (a+b);   // good
c = (a)+(b); // ERROR: a is used as a type
c = (a+b)+b; // good
return 0;
}
class T {
private int Value;
this() {
Value =1;
}
T opAdd(T inp) {
T ret = new T();
ret.Value=inp.getValue()+Value;
return ret;
}
int getValue() {
return Value;
}
}
Feb 16 2004