function type parameter inference not working

XavierAP via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Apr 25 12:19:30 PDT 2017


On Sunday, 23 April 2017 at 19:40:39 UTC, ag0aep6g wrote:
>
> Please post self-contained code. When I fill the gaps you left, 
> it works for me:

Found it! It stops working (DMD v2.073.0 for Windows) if it has 
to infer the type of a temporary local variable -- constructed in 
place of the argument:


struct Matrix(size_t nr, size_t nc) {}
struct Vector(size_t n) {}

void assembleMass1D(Mat, Vec)(ref Mat M, const ref Vec x)
{ /* ... */ }

Matrix!(2,2) M;
Vector!2     V;
assembleMass1D(M, V);          // OK
assembleMass1D(M, Vector!2()); // ERROR template cannot deduce 
function


Is this a bug?


More information about the Digitalmars-d-learn mailing list