CTFE limitation on reinterpreting cast
Rambutan
s56l6zk0w at mozmail.com
Mon Sep 28 23:35:24 UTC 2026
On Monday, 28 September 2026 at 23:20:17 UTC, monkyyy wrote:
> I believe only void* works `void* ptr=cast(void*)&Bobj;`;
> otherwise all the colored gc will get in your way. Im only
> aware of work around with type synchronicity and I probably
> have tried the hardest
I have had no trouble doing this with function pointers earlier.
Here's a meaningless small example.
```
extern(C) int f1() { return 0; }
__gshared auto f2 = cast(int function(int,char*))&f1;
void main() {}
```
This compiles just fine.
More information about the Digitalmars-d
mailing list