Cannot Instantiate SumType
Paul Backus
snarwin at gmail.com
Mon Sep 20 15:33:23 UTC 2021
On Monday, 20 September 2021 at 11:21:28 UTC, surlymoor wrote:
> 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`
> ```
Looks like this is a bug in `ReplaceType`:
```d
import std.typecons;
struct Foo(alias f) {}
void bar() {}
alias _ = ReplaceType!(int, int, Foo!bar);
```
I've submitted a bug report here:
https://issues.dlang.org/show_bug.cgi?id=22325
[1]: https://phobos.dpldocs.info/std.typecons.ReplaceType.html
More information about the Digitalmars-d-learn
mailing list