D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19447 - [REG2.066] fixed size slice assignment in ctfe loses connection with array
Summary: [REG2.066] fixed size slice assignment in ctfe loses connection with array
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: No Owner
URL:
Keywords: CTFE, wrong-code
Depends on:
Blocks:
 
Reported: 2018-11-29 17:58 UTC by anonymous4
Modified: 2018-12-14 00:12 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description anonymous4 2018-11-29 17:58:00 UTC
---
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[];
Comment 1 Walter Bright 2018-12-12 07:55:51 UTC
https://github.com/dlang/dmd/pull/9071
Comment 2 github-bugzilla 2018-12-14 00:12:15 UTC
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/c807c046be63c9787500424e64910f6d52e1f767
fix Issue 19447 - [REG2.066] fixed size slice assignment in ctfe loses connection with array

https://github.com/dlang/dmd/commit/6064ba87796fcba76f8f00613d3ae4a5c2c2376d
Merge pull request #9071 from WalterBright/fix19447

fix Issue 19447 - [REG2.066] fixed size slice assignment in ctfe lose…