[Issue 3948] Array literal assign to array of different length
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Mar 13 15:04:10 PST 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3948
--- Comment #1 from bearophile_hugs at 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: -------
More information about the Digitalmars-d-bugs
mailing list