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); } --------------
Tested on git HEAD, Linux/64. The compiler now accepts this code, looks like it's been fixed since. Please reopen if it still happens. Thanks!