[Issue 12420] [AA] Can't set associative array with array as key value using key type

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 29 20:21:23 PDT 2014


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



--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2014-03-29 20:21:09 PDT ---
(In reply to comment #0)
> 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[]
> ---

I agree with the conclusion, the reason in my thought is:

`new char[1]` makes unique data and have no foreign reference, so it can be
implicitly convertible to immutable(char[]). Therefore directly using it in the
index part of the AA element setting will be allowed.

-- 
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