| Thread overview |
|---|
13 hours ago CTFE limitation on reinterpreting cast | ||||
|---|---|---|---|---|
| ||||
![]() | Here's a tiny version of something I ran into working on a project with both C and D source, while moving into D a C global array of structs that was initialized in place.
Without the cast the initializer
Why? What can you tell me about this? Is there a workaround? Can you point me at connected documentation? Any information about this will be gratefully received. R. | |||
13 hours ago Re: CTFE limitation on reinterpreting cast | ||||
|---|---|---|---|---|
| ||||
monkyyy ![]() Posted in reply to Rambutan | On Monday, 28 September 2026 at 22:50:21 UTC, Rambutan wrote: > Here's a tiny version of something I ran into working on a project with both C and D source, while moving into D a C global array of structs that was initialized in place.
Without the cast the initializer
Why? What can you tell me about this? Is there a workaround? Can you point me at connected documentation? Any information about this will be gratefully received. R. initing is at compile time you want static this()
Since its ct and therefore ctfe, the error your getting is from the colored gc of the ctfe, its largely undocumented but its mostly implemented | |||
12 hours ago Re: CTFE limitation on reinterpreting cast | ||||
|---|---|---|---|---|
| ||||
Rambutan ![]() Posted in reply to monkyyy | On Monday, 28 September 2026 at 22:56:52 UTC, monkyyy wrote: > Since its ct and therefore ctfe, the error your getting is from the colored gc of the ctfe, its largely undocumented but its mostly implemented I should have said "is there a way to work around this at compile time?" instead of assuming that was implicit. The pointer will be no different with or without the cast. If | |||
12 hours ago Re: CTFE limitation on reinterpreting cast | ||||
|---|---|---|---|---|
| ||||
monkyyy ![]() Posted in reply to Rambutan | On Monday, 28 September 2026 at 23:14:10 UTC, Rambutan wrote: > On Monday, 28 September 2026 at 22:56:52 UTC, monkyyy wrote: >Since its ct and therefore ctfe, the error your getting is from the colored gc of the ctfe, its largely undocumented but its mostly implemented I should have said "is there a way to work around this at compile time?" instead of assuming that was implicit. The pointer will be no different with or without the cast. If I believe only void* works | |||
12 hours ago Re: CTFE limitation on reinterpreting cast | ||||
|---|---|---|---|---|
| ||||
Rambutan ![]() Posted in reply to monkyyy | On Monday, 28 September 2026 at 23:20:17 UTC, monkyyy wrote: > I believe only void* works I have had no trouble doing this with function pointers earlier. Here's a meaningless small example.
This compiles just fine. | |||
43 minutes ago Re: CTFE limitation on reinterpreting cast | ||||
|---|---|---|---|---|
| ||||
user1234 ![]() Posted in reply to Rambutan | On Monday, 28 September 2026 at 22:50:21 UTC, Rambutan wrote: > Here's a tiny version of something I ran into working on a project with both C and D source, while moving into D a C global array of structs that was initialized in place. Any information about this will be gratefully received. R. I think this is not related to CTFE, that should just work in a | |||
Permalink
Reply

