The error occurs only if $ (or length) is used to slice the array: ---- template Foo(A...) { const Foo = cast(int[])[A]; // BTW, why is the cast required here? } void main() { foreach (i; Foo!(1, 2)[1 .. $]) { } } ---- Error 42: Symbol Undefined _D4test4mainFZv8__dollark The error disappears if the array length is accessed explicitly or the test is built with -release switch.
Fixed sometime before 2.041.