On 02/10/2012 07:10 PM, Marco Leise wrote:
Am 10.02.2012, 19:07 Uhr, schrieb H. S. Teoh <hst...@quickfur.ath.cx>:
I'm not sure whether the following a compiler/language bug or a Phobos
bug, but it's definitely some kind of bug:
auto s = "abc";
immutable t = "def";
writeln(typeid(s)); // immutable(char)[]
writeln(typeid(t)); // immutable(immutable(char)[])
// (what is this supposed to mean?!)
That is supposed to mean that you can neither modify the values of the
characters in the array nor the array itself:
immutable(char[]) does already say that.
t[1] = 'a'; // immutable(char)
t.length = 2; // immutable(...[])
It is a runtime bug, and has been discussed before, but I am not sure if
it has been filed (probably yes). A similar bug has recently been fixed
for the compiler's internal formatting exposed through error
messages/.stringof:
http://d.puremagic.com/issues/show_bug.cgi?id=6941