Re: Can't cast from void*

2018-02-06 Thread Temtaime via Digitalmars-d-learn
On Tuesday, 6 February 2018 at 08:29:05 UTC, Kagamin wrote: On Monday, 5 February 2018 at 15:33:02 UTC, Steven Schveighoffer wrote: Is there a more pragmatic use case why this should be possible? Maybe for least surprise. The error message almost convinced me that such cast is impossible, onl

Re: Can't cast from void*

2018-02-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/6/18 3:29 AM, Kagamin wrote: On Monday, 5 February 2018 at 15:33:02 UTC, Steven Schveighoffer wrote: Is there a more pragmatic use case why this should be possible? Maybe for least surprise. The error message almost convinced me that such cast is impossible, only because of my memory tha

Re: Can't cast from void*

2018-02-06 Thread Kagamin via Digitalmars-d-learn
On Monday, 5 February 2018 at 15:33:02 UTC, Steven Schveighoffer wrote: Is there a more pragmatic use case why this should be possible? Maybe for least surprise. The error message almost convinced me that such cast is impossible, only because of my memory that this cast used to be possible ke

Re: Can't cast from void*

2018-02-05 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/3/18 12:37 PM, Kagamin wrote: --- interface A{} void* a=cast(void*)5; A b=cast(A)a; //ok A c=cast(A)cast(void*)5; //error --- Last line gives Error: cannot cast `void*` to `A`. Is it intended? Superficially, it looks like it should work, given the previous 2 lines. But I don't know what

Can't cast from void*

2018-02-03 Thread Kagamin via Digitalmars-d-learn
--- interface A{} void* a=cast(void*)5; A b=cast(A)a; //ok A c=cast(A)cast(void*)5; //error --- Last line gives Error: cannot cast `void*` to `A`. Is it intended?