[Issue 12420] [AA] Can't set associative array with array as key value using key type
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Jan 2 08:37:09 PST 2015
https://issues.dlang.org/show_bug.cgi?id=12420
Denis Shelomovskij <verylonglogin.reg at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|INVALID |---
--- Comment #6 from Denis Shelomovskij <verylonglogin.reg at gmail.com> ---
(In reply to Kenji Hara from comment #5)
> In D, AA requires immutability for the key.
Not now. Currently it just adds `const` qualifier. This is another Issue 12491.
> Anyway in D AA types cannot have mutable key. Therefore this issue should be
> marked as invalid.
This issue should not be marked as invalid as it results in such nonsense
compiler behaviour as `char[]` is implicitly convertible to `const char[]`:
---
void main()
{
int[char[]] aa;
auto c1 = new char[1];
aa[c1] = 5; // error
const c2 = c1;
aa[c2] = 5; // ok
}
---
--
More information about the Digitalmars-d-bugs
mailing list