Partially applied template alias messes up template inferance

Jonathan Levi catanscout at gmail.com
Wed Oct 14 02:37:25 UTC 2020


This gist gives a full example: 
https://gist.github.com/run-dlang/a28372ffaa05c3f2a4d852ca4b0a7bf5  (See the compiler error.)

In essence:
```
struct Vec(T, size_t size) {}
alias Vec2(T) = Vec(T, size);
void fun(T)(Vec2!T vec) {}

void main() {
     // Error: template fun cannot deduce function from argument 
types !()(Vec!(float, 2LU))
     fun(Vec2!float());
}
```

The template function can be written without using the alias and 
everything works great:
```
void fun(T)(Vec!(T,2) vec) {}
```

Is this fixable in the language, or is it just not feasible?






More information about the Digitalmars-d mailing list