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.

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.

Reply via email to