411 – array alloc with size from another array

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 411 - array alloc with size from another array
Summary: array alloc with size from another array
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Linux
: P2 normal
Assignee: Walter Bright
URL:
Keywords:
: 439 (view as issue list)
Depends on:
Blocks:
Reported: 2006年10月08日 19:18 UTC by Frank Benoit
Modified: 2014年02月15日 13:20 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Frank Benoit 2006年10月08日 19:18:12 UTC
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 Thomas Kühne 2006年10月12日 10:15:45 UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
d-bugmail@puremagic.com 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 Frank Benoit 2006年10月17日 05:28:16 UTC
*** Bug 439 has been marked as a duplicate of this bug. ***
Comment 3 Walter Bright 2006年10月18日 13:25:39 UTC
Fixed DMD 0.170


AltStyle によって変換されたページ (->オリジナル) /