There are two main versions of the D language. They are, in general, mutually incompatible with each other, although code can be written to compile in both.
D1 is what the code you supplied seems to be written in. It doesn't have a concept of immutable arrays, hence this works.
D2 is what you are trying to compile it as, hence the 2 beginning the compiler version number. One of the main D2-specific features is this concept of const and immutable/invariant data references.
char[] text; // mutable data
const(char)[] ctext; // data may be mutable or immutable - but either way,
// it will not be changed through this reference
invariant(char)[] itext; // immutable data
String literals in D2 are classed as immutable data, and therefore cannot be assigned to a char[], but only a const(char)[]
or invariant(char)[]
(or wchar or dchar equivalents).
string
is an alias of invariant(char)[]
, which you may want to use either for convenience or for D1 compatibility.