[Issue 11228] New: alias this confuses static array copy
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Oct 11 15:47:22 PDT 2013
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 at puremagic.com
ReportedBy: monarchdodra at gmail.com
--- Comment #0 from monarchdodra at 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: -------
More information about the Digitalmars-d-bugs
mailing list