Skip to content

Commit

Permalink
Merge pull request #5502 from wilzbach/fix-17539
Browse files Browse the repository at this point in the history
Fix Issue 17539 - std.parallellism.parallel triggers 'statement not reachable'
merged-on-behalf-of: Vladimir Panteleev <github@thecybershadow.net>
  • Loading branch information
dlang-bot committed Jul 4, 2017
2 parents d9984a3 + f3770ba commit c065234
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions std/parallelism.d
Expand Up @@ -3500,7 +3500,7 @@ int doSizeZeroCase(R, Delegate)(ref ParallelForeach!R p, Delegate dg)
{
res = dg(elem);
}
if (res) foreachErr();
if (res) break;
index++;
}
}
Expand All @@ -3516,10 +3516,11 @@ int doSizeZeroCase(R, Delegate)(ref ParallelForeach!R p, Delegate dg)
{
res = dg(elem);
}
if (res) foreachErr();
if (res) break;
index++;
}
}
if (res) foreachErr;
return res;
}
}
Expand Down Expand Up @@ -4624,3 +4625,12 @@ version(unittest)
arr.parallel.each!"a++";
})));
}

// https://issues.dlang.org/show_bug.cgi?id=17539
@system unittest
{
import std.random : rndGen;
// ensure compilation
try foreach (rnd; rndGen.parallel) break;
catch (ParallelForeachError e) {}
}

0 comments on commit c065234

Please sign in to comment.