www.digitalmars.com         C & C++   DMDScript  

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

https://d.puremagic.com/issues/show_bug.cgi?id=12330

           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



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