[Issue 3948] Array literal assign to array of different length

2010-03-17 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3948



--- Comment #2 from bearophile_h...@eml.cc 2010-03-17 12:45:03 PDT ---
See related bug 3849 too.

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


[Issue 3948] Array literal assign to array of different length

2010-03-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3948



--- Comment #1 from bearophile_h...@eml.cc 2010-03-13 15:04:09 PST ---
See also related bug 3949 .


Another case, this compiles with no errors, but it's bug-prone:

const real x = 1.2;
real[4][4] M2 = [[0, 0, 1, x], [0, 0, 0, 1]];
void main() {}



This doesn't compile:

const real x = 1.2;
real[2][4] M2 = [[0, 0, 1, x], [0, 0, 0, 1]];
void main() {}


But the error message is bad and can be improved:
test.d(3): Error: cannot implicitly convert expression ([0,0,0,1]) of type
int[] to real[2u]



This code:

real x = 1.2;
real[4][4] M2 = [[1, 0, 0, x],
 [0, 1, 0, x],
 [0, 0, 1, x],
 [0, 0, 0, 1]];
void main() {}


Produces the following errors (I don't know if this is correct):

bug1.d(5): Error: non-constant expression x
bug1.d(5): Error: non-constant expression x
bug1.d(5): Error: non-constant expression x

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