Bug 11228 – alias this confuses static array copy

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-10-11T15:47:00Z
Last change time
2013-10-14T12:37:59Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
monarchdodra

Comments

Comment #0 by monarchdodra — 2013-10-11T15:47:20Z
Scenario: Do a straight up "Array = Array". YOu must compile with -w to see it. //---- struct S { int[2] ii; alias ii this; } void main() { S s; int[2] ii; ii = ii; //OK! ii = s; //Warning: explicit element-wise assignment (ii)[] = (s)[] is better than ii = s } //---- "ii = ii;" triggers normal static array to static array copy. No need to slice. When calling "ii = s;" though, the compiler complains that you didn't slice your array. This is wrong since "ii" is a static array, and "s" aliases to a compatible static array. However, my guess is the compiler choses to see it as dynamic array assignment, and that is the reason why it complains.
Comment #1 by monarchdodra — 2013-10-13T13:19:36Z
Turns out this is a regressions actually. See also: http://d.puremagic.com/issues/show_bug.cgi?id=11244.
Comment #2 by k.hara.pg — 2013-10-14T00:28:05Z
Comment #3 by github-bugzilla — 2013-10-14T12:37:03Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/73dcca593014bae10f7b9e1915c19388305949d4 fix Issue 11228 - alias this confuses static array copy https://github.com/D-Programming-Language/dmd/commit/0084fb13aac144163ca926a8a93dd07d2780860c Merge pull request #2664 from 9rnsr/fix11228 [REG2.063] Issue 11228 - alias this confuses static array copy
Comment #4 by github-bugzilla — 2013-10-14T12:37:39Z
Commit pushed to 2.064 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/5081da0f3453566ad1be6d82c411f447444e110a Merge pull request #2664 from 9rnsr/fix11228 [REG2.063] Issue 11228 - alias this confuses static array copy