On 05.09.2016 12:25, Daniel Kozak via Digitalmars-d wrote:
Dne 5.9.2016 v 11:59 Andrea Fontana via Digitalmars-d napsal(a):
I asked this some time (years?) ago. Time for a second try :)
Consider this:
---
T simple(T)() { return T.init; }
void main()
{
int test = simple!int(); // it compiles
int test2 = simple(); // it doesn't
}
---
Is there any chance to implement this kind of deduction?
Please notice that it doesn't break any existing code, I guess.
...
Andrea
AFAIK this is impossible
It's a feature request. (Lambdas also do type deduction based on
expected type, now just do the same during IFTI, as a fallback in case
not enough information can be deduced from the arguments alone.)