September 30, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6745

           Summary: template signature match failure (matrix transpose
                    example)
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: marcianx@gmail.com


--- Comment #0 from marcianx@gmail.com 2011-09-29 19:05:20 PDT ---
I tried this on the DMD64 D compiler v2.055 on linux. The valid D code at the bottom fails with the following errors when I invoke
--------------
$ dmd template_match_bug.d
template_match_bug.d(29): Error: template
template_match_bug.mat_vec_mult_ret(int M,int N) does not match any function
template declaration
template_match_bug.d(29): Error: template
template_match_bug.mat_vec_mult_ret(int M,int N) cannot deduce template
function from argument types !()(MatrixT!(N,M),VectorT!(3),VectorT!(2))
--------------
If I comment out the definition of transposed() or the alias definition of
Mat32 (which itself is never used), then the program compiles without error.
When both are present, the bug is triggered.


--------------
struct VectorT(int N) { }

struct MatrixT(int M, int N)
{
    // Bug trigger #1
    MatrixT!(N,M) transposed() const {
        return MatrixT!(N,M)();
    }
}

void mat_vec_mult_ret(int M,int N)(
    auto ref MatrixT!(M,N) A,
    auto ref VectorT!(N) x,
    ref VectorT!(M) ret)
{
}

void main(string[] args)
{
    alias MatrixT!(3,2) Mat32; // Bug trigger #2
    alias MatrixT!(2,3) Mat23;
    alias VectorT!(3) Vec3;
    alias VectorT!(2) Vec2;

    Vec3 x;
    Vec2 Ax;
    Mat23 mat23;

    mat_vec_mult_ret(mat23, x, Ax);
}
--------------

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------