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


Denis Shelomovskij <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|patch                       |
             Status|RESOLVED                    |REOPENED
                 CC|                            |[email protected]
           Platform|x86                         |All
            Version|2.020                       |D2
         Resolution|FIXED                       |


--- Comment #8 from Denis Shelomovskij <[email protected]> 2014-03-19 
15:38:05 MSK ---
Why is it marked as fixed?

If we are talking about original testcase, just replace `hash[a]` with `const
ca = a; hash[ca]` and the program will work as in description. I see no
fundamental difference here.

Currently implemented "fix": the compiler checks whether a key as an array and,
if it is, checks whether its elements are mutable, if mutable, it complains
"...can only be assigned values with immutable keys" (note even the error
message is incorrect, not-mutable check and `immutable` in error).

IMO, the issue is associative arrays accept non-`immutable` keys and those keys
can later be changed. E.g. keys of pointers, classes, associative arrays, and
structs/unions with mutable indirection.

The whole issue is terrible and current inconsistent compiler behaviour with
incorrect error message make situation even worse. The only visible solution is
to disallow any associative array element set except with immutable key.

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

Reply via email to