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

           Summary: [AA] Can't set associative array with array as key
                    value using key type
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: verylonglogin....@gmail.com


--- Comment #0 from Denis Shelomovskij <verylonglogin....@gmail.com> 2014-03-20 
14:02:44 MSK ---
This code should compile:
---
void main()
{
    int[char[]] aa;
    aa[new char[1]] = 5; // line 4
}
---
main.d(4): Error: associative arrays can only be assigned values with immutable
keys, not char[]
---

Also the error message is wrong. The compiler expects an array of not-mutable
elements (yes, `cast(const)` will work). This incorrect compiler hack [1] was
introduced trying to fix Issue 2954 (see Comment 8 of that issue). I propose to
remove the hack.

And yes, it's a regression from 2010. )


[1] http://www.dsource.org/projects/dmd/changeset/749

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

Reply via email to