<div dir="ltr">In test23.d, there is this:<div><br></div><div><div><br></div><div>void test25()</div><div>{</div><div> char[6] cstr = "123456"c;</div><div> auto str1 = cast(wchar[3])(cstr);</div><div><br></div>
<div> writefln("str1: ", (cast(char[])str1).length , " : ", (cast(char[])str1));</div><div> assert(cast(char[])str1 == "123456"c);</div><div><br></div><div> auto str2 = cast(wchar[3])("789abc"c);</div>
<div> writefln("str2: ", (cast(char[])str2).length , " : ", (cast(char[])str2)); </div><div> assert(cast(char[])str2 == "789abc"c);</div><div><br></div><div> auto str3 = cast(wchar[3])("defghi");</div>
<div> writefln("str3: ", (cast(char[])str3).length , " : ", (cast(char[])str3)); </div><div> assert(cast(char[])str3 == "d\000e\000f\000"c);</div><div>}</div></div><div><br></div><div>I'm not sure we should allow the cast from "789abc"c to wchar[3].</div>
<div><br></div><div>I think if you want this behavior you should have to do `cast(wchar[3])cast(char[6])"789abc"`.</div><div><br></div><div>Thoughts?</div></div>