www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11228] New: alias this confuses static array copy

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11228

           Summary: alias this confuses static array copy
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: monarchdodra gmail.com


--- Comment #0 from monarchdodra gmail.com 2013-10-11 15:47:20 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 11 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11228


monarchdodra gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |regression


--- Comment #1 from monarchdodra gmail.com 2013-10-13 13:19:36 PDT ---
Turns out this is a regressions actually.

See also:
http://d.puremagic.com/issues/show_bug.cgi?id=11244.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 13 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11228


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid
            Version|unspecified                 |D2


--- Comment #2 from Kenji Hara <k.hara.pg gmail.com> 2013-10-14 00:28:05 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2664

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 14 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11228



--- Comment #3 from github-bugzilla puremagic.com 2013-10-14 12:37:03 PDT ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 14 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11228



--- Comment #4 from github-bugzilla puremagic.com 2013-10-14 12:37:39 PDT ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 14 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11228


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 14 2013