[Issue 6982] immutability isn't respected on associative array assignment
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Dec 18 07:39:19 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6982
bearophile_hugs at eml.cc changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bearophile_hugs at eml.cc
--- Comment #6 from bearophile_hugs at eml.cc 2011-12-18 07:39:16 PST ---
A related problem (I think I have already put this in Bugzilla, but I don't
remember the issue number):
void main() {
int[char[]] aa; // line 2
char[] a1 = "hello".dup;
aa[a1] = 1; // line 4
}
It's stupid for D language to accept the line 2 and then refuse line 4 with:
test.d(4): Error: associative arrays can only be assigned values with immutable
keys, not char[]
Line 2 too needs to become an error.
So a better error message is something like:
test.d(2): Error: built-in associative arrays accept only immutable keys, not
char[]
Or alternatively:
test.d(2): Error: built-in associative arrays can be defined only with
immutable keys, not char[]
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list