Template type inference problem
Manu
turkeyman at gmail.com
Wed Oct 2 08:55:15 UTC 2024
Does anyone understand why this doesn't work?
void f(T)(const(T)[] x, const(T)* y) {}
void test()
{
int*[] x;
const int* y;
f(x, &y);
}
error : template `f` is not callable using argument types `!()(int*[],
const(int*)*)`
Candidate is: `f(T)(const(T)[] x, const(T)* y)`
Should this work? It looks like it should work to me.
...assuming T is inferred to be `int*`... which it's not clear why it
wouldn't be?
The argument `y` is an exact match. The argument `x` requires a const
promotion, and then T can be inferred correctly. Perhaps it's the order of
that operation that it can't deal with?
I kinda reckon this is a bug...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20241002/04fce07a/attachment.htm>
More information about the Digitalmars-d
mailing list