From Slack by @LemonBoy
> @wilzbach, 18136 is easy to fix, you just need to check out `visit(FuncDeclaration funcdecl)' in semantic3.d where it calls f.checkRetType. It seems you must call something that increases `global.errors` first such as `error()` before you're able to construct an ErrorStatement instance.
At the moment this triggers a different error in Phobos, so it would require a bit of work to reproduce it again as the underlying phobos code apparently changed.
https://run.dlang.io/is/w3u6Oz
Comment #2 by greensunny12 — 2018-04-04T11:50:19Z
Reduced example without Phobos:
---
template ReturnType(func...)
{
static if (is(FunctionTypeOf!func R ))
alias ReturnType = R;
}
template FunctionTypeOf(func...)
{
static if (is(typeof(func) T))
static if (is(T Fptr ) )
alias FunctionTypeOf = Fptr;
}
enum isInputRange(R) =
is(ReturnType!((R r) => r.empty) )
&& is(typeof((R r) => r.popFront));
@property empty(T)(const(T) ){}
void popFront(T)(T) {}
template unaryFun(alias fun)
{
alias unaryFun = fun;
}
template map(fun...)
{
auto map(Range)(Range ) if (isInputRange!Range)
{
alias RE = Range;
alias _fun = unaryFun!fun;
!is(typeof(_fun(RE.init)) );
}
}
auto joiner(){}
struct RegexMatch(R)
{
void popFront(){}
bool empty() { }
}
auto matchMany(RegEx, R)(R , RegEx ) {
return RegexMatch!R();
}
auto matchAll(R, RegEx)(R input, RegEx re)
{
return matchMany(input, re);
}
void main()
{
string[] messages;
auto issueRE = "foo";
messages.map!(m => m.matchAll(issueRE).map);
}
---