On Fri, 24 Feb 2012 20:42:20 +0100, Justin Whear <jus...@economicmodeling.com> wrote:

On Fri, 24 Feb 2012 20:34:19 +0100, simendsjo wrote:

char[] a;
     auto b = cast(void*)a;
     auto c = cast(char[])b; // Error: e2ir: cannot cast b of type void*
     to
type char[]

Arrays have a length--you need to cast the pointer to a char*, then slice
it.

Ah, of course, thanks.
But what about static arrays?
    char[1] a;
    //a.length = 10; // constant a.length is not an lvalue
    auto b = cast(void*)a;
auto c = cast(char[1])b; // Error: e2ir: cannot cast b of type void* to type char[1LU]

Reply via email to