[Issue 20133] New: [REG2.084.0] Bogus slice assignment in recursive CTFE call

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 15 21:46:54 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=20133

          Issue ID: 20133
           Summary: [REG2.084.0] Bogus slice assignment in recursive CTFE
                    call
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: sludwig at outerproduct.org

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.

--


More information about the Digitalmars-d-bugs mailing list