www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6512] New: [CTFE] new T[][] doesn't work

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc



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: -------
Aug 16 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6512


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED



12:58:15 PDT ---
https://github.com/D-Programming-Language/dmd/commit/4fa620ba567bdf1c9be09d46d089a9fc364cc9d2

https://github.com/D-Programming-Language/dmd/commit/8f24469bd1cc3b6b33fd539ccf9d8dab3135156f

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