```
alias Fn(T) = void function(FnContainer!T);
void fn(T)(FnContainer!T) {}
struct FnContainer(T) {
Fn!T* fn;
}
void main() {
Fn!int fnInt = &fn!int;
Fn!string fnString = &fn!string;
FnContainer!string a = FnContainer!string(&fnString);
}
```
When I run `dmd a.d`, it fails with:
```
a.d(12): Error: cannot implicitly convert expression `& fnString` of type `void function(FnContainer!string)*` to `void function(FnContainer!int)*`
```
This code ought to compile since I explicitly requested a `FnContainer!string`. It is incorrectly expecting the parameter to be a `Fn!int*`.
There is no error if the unused variable `fnInt` is removed.
There is also no error if the container has `Fn!T` instead of `Fn!T*`. (In my case I actually want a function pointer pointer.)
Comment #1 by robert.schadek — 2024-12-13T19:19:22Z