Cast a struct to void*
John Colvin via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jan 13 05:40:49 PST 2015
On Friday, 9 January 2015 at 19:03:04 UTC, Steven Schveighoffer
wrote:
> On 1/9/15 1:50 PM, John Colvin wrote:
>> On Friday, 9 January 2015 at 18:35:56 UTC, anonymous wrote:
>>> On Friday, 9 January 2015 at 18:25:42 UTC, 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*
>
> This is actually a compiler bug!
So it is! The same happens with e.g. casting void* to string.
Annoyingly it passes __traits(compiles, ...)
More information about the Digitalmars-d-learn
mailing list