On 6/13/22 4:09 PM, JG wrote:
Thanks. It seems to be something to do with the variadic template since this
works:

```d
import std;

struct ParseError { string msg; }

alias ParseErrorOr(T) = SumType!(ParseError,T);
auto parseErrorOr(T)(T x) { return ParseErrorOr!T(x); }

auto parserOr(I,alias f, alias g)(I i) {
   auto cur = f(i);
   if(cur.match!((ParseError e)=>false,_=>true)) { return cur; }
   return g(i);
}

auto parseNothing(I)(I i) {
     return parseErrorOr(tuple(i[0..0],i));
}

void main()
{
    enum a = parserOr!(string,parseNothing!string,parseNothing!string)("hello");
}
```

Given that it's inside `moveEmplace`, I'd suspect something deep in `SumType`.

-Steve

Reply via email to