The following snippet yields "Error: array length mismatch assigning `[0..1]` to `[1..3]`", although no slice assignment should be going on:
---
void bar(ref string text)
{
text = text[1 .. $];
string tcopy = text;
if (tcopy.length > 0)
bar(tcopy);
}
enum test = {
string input = "foo";
bar(input);
return input;
} ();
---
Works as expected up to DMD 2.083.1.
Comment #1 by razvan.nitu1305 — 2019-08-19T15:06:29Z
@BorisCarvajal created dlang/dmd pull request #13228 "Fix Issue 20133 - [REG2.084.0] Bogus slice assignment in recursive CTFE call" fixing this issue:
- Fix Issue 20133 - [REG2.084.0] Bogus slice assignment in recursive CTFE call
https://github.com/dlang/dmd/pull/13228
Comment #3 by dlang-bot — 2021-10-27T09:53:48Z
dlang/dmd pull request #13228 "Fix Issue 20133 - [REG2.084.0] Bogus slice assignment in recursive CTFE call" was merged into stable:
- 72087baef11a71d2c6f6ea9bde9885a860cb658c by Boris Carvajal:
Fix Issue 20133 - [REG2.084.0] Bogus slice assignment in recursive CTFE call
https://github.com/dlang/dmd/pull/13228
Comment #4 by dlang-bot — 2021-11-08T20:45:36Z
dlang/dmd pull request #13279 "Merge `stable` into `master`" was merged into master:
- 2d495c7c2073f7fb2234f81602dc9ec9af0c93b8 by Boris Carvajal:
Fix Issue 20133 - [REG2.084.0] Bogus slice assignment in recursive CTFE call
https://github.com/dlang/dmd/pull/13279