On Monday, 2 May 2022 at 16:29:05 UTC, Loara wrote:
On Sunday, 1 May 2022 at 03:57:12 UTC, Elfstone wrote:
[...]
Template deduction for aliased function parameter is a very
tricky argument and it's not so simple to handle in certain
cases. Consider for example this code:
```d
template MyAlias(T){
alias MyAlias = int;
}
T simp(T)(MyAlias!T val){
return T.init;
}
int main(){
simp(3);//Impossible to deduce T
simp( cast(MyAlias!string) 4);//Also invalid since
MyAlias!string is exactly int
simp!string(4);//Ok, no parameter deduction
}
```
I don't really see what your example is trying to show. This also
doesn't work,
and in my mind should be equivalent:
```d
T simp(T)(int val) {
return T.init;
}
int main() {
simp(3);//Impossible to deduce T
}
```