On 12/10/2011 11:18 AM, Mehrdad wrote:
... and another...

struct S(T, int N)
{ public auto opBinary(string op)(in S!(T, N) other) const { return
this; } }
void main() { S!(int, 1) m; m = m * m; }

Error: 'm' is not of arithmetic type, it is a Matrix!(int,1)
Error: 'm' is not of arithmetic type, it is a Matrix!(int,1)

It is unrelated to const, this gives the same error.
struct S(T, int N)
{ public auto opBinary(string op)(S!(T, N) other) { return this; } }
void main() { S!(int, 1) m; m = m * m; }

And this works:

struct S(T, int N)
{ public auto opBinary(string op)(in S other) const { return this; } }
void main() { S!(int, 1) m; m = m * m; }

You have to make sure that the signature of your template actually compiles. Maybe the compiler should emit a diagnostic for that case.


If you blame all your compile errors on const, I can understand why you think its design is broken.

Reply via email to