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

Nicholas Wilson iamthewilsonator at hotmail.com
Thu Aug 2 01:39:58 UTC 2018


On Wednesday, 1 August 2018 at 20:10:44 UTC, Hakan Aras wrote:
> On Wednesday, 1 August 2018 at 16:25:28 UTC, Hakan Aras wrote:
>
>>
>> https://run.dlang.io/is/dSVruv
>>
>
> Whoops, that was the wrong one. It's fixed now.

https://issues.dlang.org/show_bug.cgi?id=19134

As a workaround remove static, as that causes y to be initialised 
at compile time. 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.


More information about the Digitalmars-d-learn mailing list