www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6745] New: template signature match failure (matrix transpose example)

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



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)
{

    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!(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: -------
Sep 29 2011