www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5685] New: Static Arrays as AA indices

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

           Summary: Static Arrays as AA indices
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid, wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: dsimcha yahoo.com



The following (arguably valid, arguably invalid) code compiles successfully but
produces wrong results at runtime:

void main() {
    int[2] foo = [1, 2];
    string[int[2]] aa;
    aa[foo] = "";
    assert([1, 2] in aa);  // FAILS
}

It should either be a compiler error (if the literal [1, 2] is treated as a
dynamic array and polymorphism between dynamic and static arrays is disallowed)
or it should work.

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