void foo() { (void[1]).init.front; } void front(T)(T[] a) {} hangs the compiler forever, chewing through memory.
The loop happens in dmd.optimize.Expression.Expression_optimize(Expression e, int result, bool keepLvalue) But the background problem is that template parameter type deduction gives `ubyte ` instead of `void`. As a consequence the protections against infinite recursion when the optimizer visit a CastExpression don't work. For example by rewriting the call in the test case this way (void[1]).init.front!void; that works but (void[1]).init.front!ubyte; loops...
@StianGulpen created dlang/dmd pull request #10571 "fix issue 20092 - void[1] auto slicing makes the compiler hang" fixing this issue: - fix issue 20092 - void[1] auto slicing makes the compiler hang https://github.com/dlang/dmd/pull/10571
dlang/dmd pull request #10571 "fix issue 20092 - void[1] auto slicing makes the compiler hang" was merged into stable: - 738b5badd4b4395f7d2fce2e4b2a7c27b071be66 by Stian Gulpen: fix issue 20092 - void[1] auto slicing makes the compiler hang https://github.com/dlang/dmd/pull/10571
dlang/dmd pull request #11621 "[dmd-cxx] Fix Issue 20092 and Issue 20356 - recursive expansion/optimization fixes" was merged into dmd-cxx: - 3cb450d070c5acffd0e848834ca3d34a585e0740 by Iain Buclaw: [dmd-cxx] Fix Issue 20092 - void[1] auto slicing makes the compiler hang Adds enum global.recursionLimit and uses it in all places where such errors can occur. https://github.com/dlang/dmd/pull/11621