Cast a struct to void*

John Colvin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 9 10:25:41 PST 2015


struct S
{
     void* p;
}

void main()
{
     S s;
     auto a = cast(void*)s; //Error: e2ir: cannot cast s of type S 
to type void*
}

Is there are a good reason for this being disallowed?


More information about the Digitalmars-d-learn mailing list