www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12728] New: GIT HEAD : Error X is not of arithmetic type

https://issues.dlang.org/show_bug.cgi?id=12728

          Issue ID: 12728
           Summary: GIT HEAD : Error X is not of arithmetic type
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: temtaime gmail.com

struct Matrix(T, uint M, uint N = M, ubyte _F = 0) {


    pure opBinary(string op : `*`, uint R)(auto ref in Matrix!(T, N, R) b)
const { return Matrix!(T, M, R)(); }

    pure opUnary(string op: `-`)() const { return Matrix(); }

    ref translate()(auto ref in Vector3 v) { return this; }
}

alias Vector(T, uint M) = Matrix!(T, 1, M);

alias Matrix4 = Matrix!(float, 4);
alias Vector3 = Vector!(float, 3);

void main() {
    Matrix4 m;
    m * m.translate(-Vector3());
}

This code should work and works on 065.

--
May 10 2014