On Tue, Jan 3, 2012 at 1:41 PM, Andrew Wiley <wiley.andre...@gmail.com> wrote: > On Tue, Jan 3, 2012 at 1:25 PM, simendsjo <simend...@gmail.com> wrote: >> seems T[char[]] is rewritten as T[const(char)[]], and does not accept char[] >> as key even if mutable data should automatically convert to const (right..?) >> >> Shouldn't T[char[]] be disallowed, and have to be written as >> T[immutable(char)[]] instead of a silent rewrite? >> >> >> alias long[char[]] AA; >> // key automatically changed to const(char)[] >> static assert(is(AA == long[const(char)[]])); >> AA aa; >> aa["a"] = 10; >> // error - have to use immutable keys >> aa["b".dup] = 11; > > By design, the problem is things like this: > > char[] key = "somekey";
Sorry, should be: char[] key = "somekey".dup;