Bug 783 – Cannot use an array w/ const or variable index as new[] size argument.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2007-01-01T12:18:00Z
Last change time
2015-06-09T05:11:58Z
Keywords
pull, rejects-valid
Assigned to
yebblies
Creator
godaves

Comments

Comment #0 by godaves — 2007-01-01T12:18:12Z
const arr = [ 1,2,3 ]; void main() { int[] ar2; ar2 = new int[arr[2]]; // OK const i = 2; ar2 = new int[arr[i]]; // "need size of rightmost array, not type arr[i]" size_t j = 2; ar2 = new int[arr[j]]; // "need size of rightmost array, not type arr[j]" }
Comment #1 by thomas-dloop — 2007-02-27T10:47:44Z
Comment #2 by smjg — 2007-09-18T16:24:11Z
Please remember to assign keywords to bug reports. To everybody reading this: Please look through issues you've reported and check for missing keywords.
Comment #3 by matti.niemenmaa+dbugzilla — 2010-02-18T11:38:38Z
*** Issue 3823 has been marked as a duplicate of this issue. ***
Comment #4 by yebblies — 2012-02-01T06:44:15Z
Comment #5 by yebblies — 2012-02-01T07:28:52Z
*** Issue 2712 has been marked as a duplicate of this issue. ***
Comment #6 by bugzilla — 2012-02-01T14:13:40Z
Please use 'pull' keyword for ones with a pull request.
Comment #7 by github-bugzilla — 2012-03-08T14:05:09Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/97b4410ba1c55d77f54821249d048add3c2acd47 Merge pull request #679 from yebblies/issue783 Issue 783 - Cannot use an array w/ const or variable index as new[] size argument.