given the following code
---
struct Matrix(T) {}
struct Kernel(T) {}
void calculateKernelMatrix(K, T)(K!T kernel, Matrix!T data)
if (__traits(isTemplate, K))
{ }
void main()
{
Matrix!float m;
Kernel!float k;
version (all) calculateKernelMatrix(k,m); // case 1
version (none) calculateKernelMatrix!(typeof(m), typeof(k))(k,m); // case 2
}
---
for the case 1 we got
> /tmp/temp_7F8FE34BE6D0.d(16,26): Error: template `runnable.calculateKernelMatrix` cannot deduce function from argument types `!()(Kernel!float, Matrix!float)`, candidates are:
> /tmp/temp_7F8FE34BE6D0.d(8,6): `calculateKernelMatrix(K, T)(K!T kernel, Matrix!T data)`
for case 2, dont forget to invert the versions...) we got
> /tmp/temp_7F8FE34BE6D0.d(17,5): Error: template instance `runnable.calculateKernelMatrix!(Matrix!float, Kernel!float)` does not match template declaration `calculateKernelMatrix(K, T)(K!T kernel, Matrix!T data)`
> with `K = Matrix!float,
> T = Kernel!float`
> must satisfy the following constraint:
> ` __traits(isTemplate, K)`
the for case 1 we could expect the same diagnostic as in case 2
Comment #1 by robert.schadek — 2024-12-13T19:08:47Z