[Issue 2732] Setting new key for Associative Array of Static Array causes RangeError
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Mar 30 04:02:45 PDT 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2732
------- Comment #2 from hskwk at inter7.jp 2009-03-30 06:02 -------
(In reply to comment #1)
real[2][int] hash = null;
real[2] v = [3,4];
*(hash[0])=1;
write(hash[0]);
// -> [1 0], very strange result. where does 0 come from? *1
hash[0]=v;
write(hash[0]);
// -> [3 4], it works well if key have been already set.
*1
real.init is NaN. actually: write(new real[2]) -> [nan nan].
This test code might show us a different bug of accepts-invalid.
To make matters worse, following code is compiled without any error
and cause runtime object.Exception: lengths don't match for array copy.
real[1] v = [3,4];
I think that this code should be an compile-time error because
the compiler knows types of both `real[1] v' and `[3,4]'.
I will report these bugs if they have not been reported on this tracking
system.
--
More information about the Digitalmars-d-bugs
mailing list