The simplest code that shows the issue:
```d
struct S{}

template f(void function(S) F) {}
template f(int function(S) F) {}

mixin f!((_) {});
mixin f!((_) => 0); // Error: cannot return non-void from `void` function
                     // mixin f!((_) => 0);
                     //                 ^
// while looking for match for `f!((_) => 0)`
                     // mixin f!((_) => 0);
```

If I swap `template f` declarations:
```d
struct S{}

template f(int function(S) F) {}
template f(void function(S) F) {}

mixin f!((_) {}); // Error: function `onlineapp.__lambda_L8_C10(__T1)(_)` has no `return` statement, but is expected to return a value of type `int`
                  // mixin f!((_) {});
                  //          ^
                  //         while looking for match for `f!((_)
                  // {
                  // }
                  // )`
                  // mixin f!((_) {});
                  // ^
mixin f!((_) => 0);
```

But if I remove `S` from template parameters, everything works:
```d
template f(int function() F) {}
template f(void function() F) {}

mixin f!(() {});
mixin f!(() => 0);
```

Is this a bug somewhere in compiler or in my code?

Reply via email to