pointer cast from const(Y) to immutable(void*)** is not supported at compile time

Nicholas Wilson iamthewilsonator at hotmail.com
Thu Aug 2 02:50:54 UTC 2018


On Thursday, 2 August 2018 at 02:13:41 UTC, Hakan Aras wrote:
> On Thursday, 2 August 2018 at 01:39:58 UTC, Nicholas Wilson 
> wrote:
>
>> https://issues.dlang.org/show_bug.cgi?id=19134
>>
>
> I wasn't quite sure whether it's a bug since it happens in both 
> compilers. Thanks for opening the issue.
>

For future reference the only time you should consider LDC/GDC 
distinct from DMD is codegen, i.e. compiler causes your code to 
crash. This is a frontend bug so it affects all the major 
compilers.

>> As a workaround remove static, as that causes y to be 
>> initialised at compile time.
>
> I do want it at compiletime though.
>
>> static here has nothing to do with static_cast in C++.
>> The analogy to a static_cast would be
>>
>> const X x = new Y();
>>
>> casting up the hierarchy, as opposed to dynamic casting down 
>> the hierarchy.
>
> Sorry, I actually meant a reinterpret_cast. I always get those 
> mixed up. But now that I look at it again I don't see how that 
> would help me, since my code isn't the one trying to to casting.

Ah, unfortunately you're stuck then.


More information about the Digitalmars-d-learn mailing list