Thread overview
[Issue 2712] New: error with passing an array slot as another array length to new
Mar 06, 2009
d-bugmail
Jan 27, 2010
Don
Feb 01, 2012
yebblies
March 06, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2712

           Summary: error with passing an array slot as another array length
                    to new
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: andrei@metalanguage.com


void foo(uint n, in uint[] x)
{
    auto y = new uint[x[n]];
}

void main()
{
    foo(new uint[10]);
}

Error: need size of rightmost array, not type x[n]


-- 

January 27, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2712


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug@yahoo.com.au
            Version|unspecified                 |1.00


--- Comment #1 from Don <clugdbug@yahoo.com.au> 2010-01-27 02:43:25 PST ---
This is a parsing error. Workaround: Adding () around the x[n] allows it to
compile.

void foo(uint n, in uint[] x) {
    auto y = new uint[ (x[n]) ];
}

void main() {
    foo(7, new uint[10]);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 01, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2712


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies@gmail.com
         Resolution|                            |DUPLICATE


--- Comment #2 from yebblies <yebblies@gmail.com> 2012-02-02 02:28:52 EST ---
*** This issue has been marked as a duplicate of issue 783 ***

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