[Issue 12330] New: array.reserve at compile time too

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 9 07:28:26 PDT 2014


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 at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at 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: -------


More information about the Digitalmars-d-bugs mailing list