[Issue 12365] Assigning 1D array to 2D array should require cast

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 14 16:49:42 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12365



--- Comment #1 from growlercab at gmail.com 2014-03-14 16:49:41 PDT ---
I'm not sure how to do the cast on initialisation though:
---
// Ex.1
void main()
{
    int[] a=[1,2,3,4];
    int[2][2] b = a;
}
---

Would it be:
    int[2][2] b = cast(int[2][2])a;

but it does not match the existing casts required for assignment:    

    cast(int[4])b = a;

Maybe just disallow code as per Ex.1 and only allow the cast assignment from
Ex.2?


Thanks,
ed

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


More information about the Digitalmars-d-bugs mailing list