Cannot Instantiate SumType
surlymoor
surlymoor at cock.li
Mon Sep 20 11:21:28 UTC 2021
I'm experiencing an error when instantiating `SumType` with an
aggregate template that itself is instantiated with a void
function. In other words...
```d
struct Foo(alias f) {}
// As the error implies, altering it to be non-void makes
everything copacetic~
void bar() {}
alias S = SumType!(Foo!bar);
```
The error in question...
```
Error: variable
`std.typecons.ReplaceTypeUnless!(isSumTypeInstance, This,
SumType!(Foo!(bar)), Foo!(bar)).F!(bar).replaceTemplateArgs` type
`void` is inferred from initializer `bar()`, and variables cannot
be of type `void`
```
Perhaps I'm dong something stupid, or failing to realize, because
all the glue sniffing I did when I was younger has finally
manifested itself, but if it's not, is there a workaround?
More information about the Digitalmars-d-learn
mailing list