[Issue 11733] New: Refuse int indexing of associative arrays with char keys

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 12 10:11:22 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11733

           Summary: Refuse int indexing of associative arrays with char
                    keys
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          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 2013-12-12 10:11:20 PST ---
I think this code should be disallowed:


void main() {
    int[char] aa1;
    int[dchar] aa2;
    auto r1 = aa1[0];
    auto r2 = aa2[0];
}


dmd 2.065alpha compiles it with no errors, and gives at run-time:

core.exception.RangeError at temp(4): Range violation

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


More information about the Digitalmars-d-bugs mailing list