[Issue 12420] New: [AA] Can't set associative array with array as key value using key type
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Mar 20 03:02:51 PDT 2014
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: nobody at puremagic.com
ReportedBy: verylonglogin.reg at gmail.com
--- Comment #0 from Denis Shelomovskij <verylonglogin.reg at 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: -------
More information about the Digitalmars-d-bugs
mailing list