On Monday, 9 August 2021 at 22:30:43 UTC, Ali Çehreli wrote:
I don't know the reason but I suspect a bug in the compile-time checker that involves .init values for arguments.

The compile time checker is pretty bad tbh, it just tries to ctfe execute the given string and sees if it throws. That's kinda clever; the simplest thing that can possibly work, no doubt. But since ctfe cannot work with certain things - like the pointer casts which are done here* - this makes it a bit fragile. And the implementation is really really slow and pretty bloated in codegen too.

My personal policy is to never use it.

* The compiler probably could special-case `null` at least since that's consistently 0 in D.

Perhaps the un-typed 'null' literal is used somewhere.

The line is this:

const pnum = () @trusted { return cast(ulong) p; }();


Which is already blargh code, but in ctfe it is a prohibited operation.

Reply via email to