www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 digitalmars.com
        ReportedBy: godaves 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]"
}


-- 
Jan 01 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=783





------- Comment #1 from thomas-dloop kuehne.cn  2007-02-27 10:47 -------
Added to DStress as
http://dstress.kuehne.cn/run/a/array_initialization_32_A.d
http://dstress.kuehne.cn/run/a/array_initialization_32_B.d
http://dstress.kuehne.cn/run/a/array_initialization_32_C.d
http://dstress.kuehne.cn/run/a/array_initialization_32_D.d


-- 
Feb 27 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=783


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com
           Keywords|                            |rejects-valid




------- Comment #2 from smjg iname.com  2007-09-18 16:24 -------
Please remember to assign keywords to bug reports.  To everybody reading this:
Please look through issues you've reported and check for missing keywords.


-- 
Sep 18 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=783


Matti Niemenmaa <matti.niemenmaa+dbugzilla iki.fi> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc


--- Comment #3 from Matti Niemenmaa <matti.niemenmaa+dbugzilla iki.fi>
2010-02-18 11:38:38 PST ---
*** Issue 3823 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 18 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=783


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei metalanguage.com
         AssignedTo|nobody puremagic.com        |bugzilla digitalmars.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 26 2010