[Issue 783] New: Cannot use an array w/ const or variable index as new[] size argument.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 1 10:18:15 PST 2007


http://d.puremagic.com/issues/show_bug.cgi?id=783

           Summary: Cannot use an array w/ const or variable index as new[]
                    size argument.
           Product: D
           Version: 0.178
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: godaves at yahoo.com


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]"
}


-- 



More information about the Digitalmars-d-bugs mailing list