example: import std.parallelism; void main() { int x[100_000]; parallel(x); } If you remove one 0 from the number of elements, the compile finishes with an error: /Users/steves/git/dmd2/osx/bin/../../src/phobos/std/parallelism.d-mixin-3780(3878): Error: template std.range.primitives.popFront cannot deduce function from argument types !()(int[10000]), candidates are: /Users/steves/git/dmd2/osx/bin/../../src/phobos/std/range/primitives.d(2032): std.range.primitives.popFront(T)(ref T[] a) if (!isNarrowString!(T[]) && !is(T[] == void[])) /Users/steves/git/dmd2/osx/bin/../../src/phobos/std/range/primitives.d(2055): std.range.primitives.popFront(C)(ref C[] str) if (isNarrowString!(C[])) /Users/steves/git/dmd2/osx/bin/../../src/phobos/std/parallelism.d-mixin-3780(3867): Error: function std.parallelism.ParallelForeach!(int[10000]).ParallelForeach.opApply.doIt.makeTemp no return exp; or assert(0); at end of function /Users/steves/git/dmd2/osx/bin/../../src/phobos/std/parallelism.d-mixin-3792(3890): Error: template std.range.primitives.popFront cannot deduce function from argument types !()(int[10000]), candidates are: /Users/steves/git/dmd2/osx/bin/../../src/phobos/std/range/primitives.d(2032): std.range.primitives.popFront(T)(ref T[] a) if (!isNarrowString!(T[]) && !is(T[] == void[])) /Users/steves/git/dmd2/osx/bin/../../src/phobos/std/range/primitives.d(2055): std.range.primitives.popFront(C)(ref C[] str) if (isNarrowString!(C[])) /Users/steves/git/dmd2/osx/bin/../../src/phobos/std/parallelism.d-mixin-3792(3879): Error: function std.parallelism.ParallelForeach!(int[10000]).ParallelForeach.opApply.doIt.makeTemp no return exp; or assert(0); at end of function /Users/steves/git/dmd2/osx/bin/../../src/phobos/std/parallelism.d(3303): Error: template instance std.parallelism.ParallelForeach!(int[10000]) error instantiating testarray.d(6): instantiated from here: parallel!(int[10000]) I'm unsure if this is a bug in the compiler or a bug in std.parallelism. I don't know how the latter is designed to work, but it does appear that there isn't a valid instantiation for it, so I would suspect a compiler issue. The timing seems to be non-linear based on the number of elements: 10k elements: 1.5 seconds to reach error 20k elements: 5.2 seconds to reach error 30k elements: 12.2 seconds to reach error 40k elements: 20.9 seconds to reach error 50k elements: 32.9 seconds to reach error I stopped after that :)
Forgot to link thread that started this bug: http://forum.dlang.org/post/cxfeijupkxsfqmqyjovj@forum.dlang.org
Regression, introduced in https://github.com/D-Programming-Language/dmd/pull/3801
Reduced test case: @property ref T front(T)(T[] a) { return a[0]; } template ElementType(R) { static if (is(typeof(R.init.front.init) T)) alias ElementType = T; else alias ElementType = void; } void main() { alias R = int[100_000]; alias E = ElementType!R; }
More: auto front(T)(T[] a) {} void main() { alias R = int[100_000]; alias E = typeof(front(R.init)); }
*** Issue 15062 has been marked as a duplicate of this issue. ***
https://github.com/D-Programming-Language/dmd/pull/5085
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/51ecaf8e47c82f41115cc1d59c6ed384e234eb60 fix Issue 14886 - std.parallelism.parallel with large static array seems to hang compile Add ArrayLiteralExp.basis for repeated array literal elements. https://github.com/D-Programming-Language/dmd/commit/a492f916d022698edb025c4b206ad1af75e0913d Merge pull request #5085 from 9rnsr/fix14886 [REG2.066] Issue 14886 - std.parallelism.parallel with large static array seems to hang compile
*** Issue 10716 has been marked as a duplicate of this issue. ***
Commit pushed to dmd-cxx at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/53ce42c3256e7a2265613a30399345eac85a7343 Issue 14886 - std.parallelism.parallel with large static array seems to hang compile