D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 783 - Cannot use an array w/ const or variable index as new[] size argument.
Summary: Cannot use an array w/ const or variable index as new[] size argument.
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: yebblies
URL:
Keywords: pull, rejects-valid
: 2712 3823 (view as issue list)
Depends on:
Blocks:
 
Reported: 2007-01-01 12:18 UTC by Dave
Modified: 2015-06-09 05:11 UTC (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Dave 2007-01-01 12:18:12 UTC
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 2 Stewart Gordon 2007-09-18 16:24:11 UTC
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 Matti Niemenmaa 2010-02-18 11:38:38 UTC
*** Issue 3823 has been marked as a duplicate of this issue. ***
Comment 5 yebblies 2012-02-01 07:28:52 UTC
*** Issue 2712 has been marked as a duplicate of this issue. ***
Comment 6 Walter Bright 2012-02-01 14:13:40 UTC
Please use 'pull' keyword for ones with a pull request.
Comment 7 github-bugzilla 2012-03-08 14:05:09 UTC
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.