It compiles with dmd 2.057. But with head commit (12d62ca5): Assertion failure: '((ArrayLiteralExp *)se->e1)->ownedByCtfe' on line 6315 in file 'interpret.c' --- int[] f() { return [0]; } int g(int[] r) { auto t = r[0..0]; return 0; } static assert(g(f()) == 0); ---
https://github.com/D-Programming-Language/dmd/commit/2605252929c5122341d3ecae77df1374e4131059 https://github.com/D-Programming-Language/dmd/commit/75fc400041049ab89f0ac5764a3ee7620db02d88
If an argument is added to `f` with head commit (227769c4): Assertion failure: '((ArrayLiteralExp *)se->e1)->ownedByCtfe' on line 6307 in file 'interpret.c' --- int[] f(int) { return [0]; } int g(int[] r) { auto t = r[0..0]; return 0; } static assert(g(f(0)) == 0); ---
https://github.com/D-Programming-Language/dmd/commit/51bc588d2e834650e5278247cd06b5da36569feb https://github.com/D-Programming-Language/dmd/pull/602
If const cast and struct are added, with head commit (d2b8eadf): Assertion failure: '((ArrayLiteralExp *)se->e1)->ownedByCtfe' on line 6337 in file 'interpret.c' --- struct S { const(int)[] field; } const(int)[] f() { int[] arr = []; const(int)[] str = arr; auto s = S(str); return s.field; } int g(const(int)[] r) { auto t = r[0..0]; return 0; } static assert(g(f()) == 0); --- This affects Appender using with CTFE.
https://github.com/D-Programming-Language/dmd/commit/1cbd1959e41d39c812a8f4c1a17eb8535d44547a https://github.com/D-Programming-Language/dmd/commit/1394b3c55c740106555cd484697019e4a9b77109