Bug 411 – array alloc with size from another array

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2006-10-08T19:18:00Z
Last change time
2014-02-15T13:20:13Z
Assigned to
bugzilla
Creator
benoit

Comments

Comment #0 by benoit — 2006-10-08T19:18:12Z
void main(){ int[] ia; ia ~= 3; byte[] data = new byte[ia[0]]; // line 5 byte[] data2 = new byte[ cast(int)(ia[s])]; // this compiles } a.d(5): need size of rightmost array, not type ia[0]
Comment #1 by thomas-dloop — 2006-10-12T10:15:45Z
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [email protected] schrieb am 2006-10-09: > http://d.puremagic.com/issues/show_bug.cgi?id=411 > void main(){ > int[] ia; > ia ~= 3; > byte[] data = new byte[ia[0]]; // line 5 > byte[] data2 = new byte[ cast(int)(ia[s])]; // this compiles > } > > a.d(5): need size of rightmost array, not type ia[0] Added to DStress as http://dstress.kuehne.cn/run/a/array_initialization_28_A.d http://dstress.kuehne.cn/run/a/array_initialization_28_B.d http://dstress.kuehne.cn/run/a/array_initialization_28_C.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFLlhBLK5blCcjpWoRAlQ5AJsEkjPUjsAlKXKtndnBpGIMXFA48gCghARl lOPJDR/hCDGqqkfR9vHjpeI= =9PWe -----END PGP SIGNATURE-----
Comment #2 by benoit — 2006-10-17T05:28:16Z
*** Bug 439 has been marked as a duplicate of this bug. ***
Comment #3 by bugzilla — 2006-10-18T13:25:39Z
Fixed DMD 0.170