[Issue 13244] Wrong code with -inline and foreach/map/all
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Aug 3 00:35:43 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13244
--- Comment #1 from Vladimir Panteleev <thecybershadow at gmail.com> ---
Reduced:
//////////////// test.d ///////////////
struct MapResult(alias fun)
{
@property empty() { return false; }
void popFront() { }
@property front()
{
return fun(0);
}
}
auto map(alias fun)()
{
return MapResult!fun();
}
void all(Range)(Range haystack)
{
foreach (e; haystack)
if (e)
return;
}
void main()
{
auto arr = [[1]];
foreach (ref x; arr)
map!(c => x[c]).all;
}
///////////////////////////////////////
--
More information about the Digitalmars-d-bugs
mailing list