www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12330] New: array.reserve at compile time too


           Summary: array.reserve at compile time too
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc

--- Comment #0 from bearophile_hugs eml.cc 2014-03-09 07:28:25 PDT ---
int[] foo() {
    int[] result;
    result.reserve = 5;
    return result;
enum r = foo();
void main() {}

dmd 2.066alpha gives:

...\dmd2\src\druntime\import\object.di(550,31): Error: _d_arraysetcapacity
cannot be interpreted at compile time, because it has no available source code
test.d(3,11):        called from here: reserve(result, 5u)
test.d(6,13):        called from here: foo()

It could be useful for situations like Issue 12315

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