See https://run.dlang.io/is/hNaSFh:

```d
import std.sumtype;

struct Unit {}
alias Option(T) = SumType!(T, Unit);

void foobar(T)(Option!T option) {}

void main() {
    foobar(Option!int(123));
}
```

If you run this, the compiler should emit this error:

```d
onlineapp.d(14): Error: template `onlineapp.foobar` cannot deduce function from argument types `!()(SumType!(int, Unit))`
onlineapp.d(8):        Candidate is: `foobar(T)(Option!T option)`
```

If you change `foobar`’s parameter’s type from `Option!T` to `SumType!(T, Unit)`, it compiles without error.

Surely this is not intended? Is this a compiler bug or am I doing something wrong?

Cheers!

Reply via email to