[Issue 18136] ICE in dmd/statement.d(426)
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Apr 4 11:50:19 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18136
--- Comment #2 from Seb <greensunny12 at gmail.com> ---
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);
}
---
--
More information about the Digitalmars-d-bugs
mailing list