On 01/09/2015 10:25 AM, John Colvin wrote:
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?

I know two options:

a)

    alias p this;

b)

    auto opCast(T : void*)()
    {
        return p;
    }

Ali

Reply via email to