[Issue 6512] New: [CTFE] new T[][] doesn't work

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 16 13:51:23 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6512

           Summary: [CTFE] new T[][] doesn't work
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-08-16 13:51:20 PDT ---
This is almost an enhancement request.


int foo() {
    new int[][](1, 1);
    return 0;
}
enum _ = foo();
void main() {}


test.d(2): Error: Cannot interpret new int[][](1u,1u) at compile time
test.d(5): Error: cannot evaluate foo() at compile time


While this code works:

int foo() {
    int[][] m;
    m.length = 1;
    m[0].length = 1;
    assert(m == [[0]]);
    return 0;
}
enum _ = foo();
void main() {}

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


More information about the Digitalmars-d-bugs mailing list