[Issue 19447] New: [REG2.066] fixed size slice assignment in ctfe loses connection with array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 29 17:58:00 UTC 2018


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

          Issue ID: 19447
           Summary: [REG2.066] fixed size slice assignment in ctfe loses
                    connection with array
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: CTFE, wrong-code
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dfj1esp02 at sneakemail.com

---
bool f()
{
    int[3] a=1;
    assert(a[0]==1);
    g(a[0..2]);
    assert(a[0]!=1); //fails
    assert(a[0]==2);
    return true;
}
void g(ref int[2] a)
{
    int[2] b=2;
    a=b;
    assert(a[0]==2);
}
static assert(f());
---
The feature was apparently introduced in 2.063 and worked until 2.066.
Works with explicit array operation a[]=b[];

--


More information about the Digitalmars-d-bugs mailing list