[Issue 13799] New: Whole-array initialization for static fixed-size arrays of arrays too
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Sun Nov 30 03:13:21 PST 2014
    
    
  
https://issues.dlang.org/show_bug.cgi?id=13799
          Issue ID: 13799
           Summary: Whole-array initialization for static fixed-size
                    arrays of arrays too
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: bearophile_hugs at eml.cc
Please allow the missing common case too:
int[2][2] m1 = [[1, 1], [1, 1]]; // OK
int[2][2] m2 = 1; // Error
void main() {
    int[2][2] m3 = [[1, 1], [1, 1]]; // OK
    int[2][2] m4 = 1; // OK
}
dmd 2.067alpha:
test.d(2,16): Error: cannot implicitly convert expression (1) of type int to
int[2][2]
It's expecially useful when the size is a compile-time constant defined
elsewhere that is not known locally:
enum N = 5;
int[N][N] m = 1; // Error
void main() {}
--
    
    
More information about the Digitalmars-d-bugs
mailing list