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

           Summary: In array literals single values can replace arrays of
                    length 1
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2010-08-01 15:27:31 PDT ---
This program compiles with no errors with dmd 2.047:

int[1][3] a1 = [1, 2, 3];
void main() {
    int[1][3] a2 = [1, 2, 3];
}


But those array literals are wrong. This is the correct program:

int[1][3] a1 = [[1], [2], [3]];
void main() {
    int[1][3] a2 = [[1], [2], [3]];
}


A sloppy syntax is bad because it *always* offers space for bugs, like this
one, dmd compiles this program with no errors (note the missing comma):


int[1][3] a = [[1] [0], [2]];
void main() {}


Now a contains [1, 2, 0], a silent bug.
This situation is partially caused by bug 3849

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

Reply via email to