reduced:
---
struct StoreAny {
ubyte[16] store;
this(T)(T value) {
*(cast(T*) store) = value;
}
}
struct SomeStruct {}
enum StoreAny someEnum = StoreAny(SomeStruct());
void main() {
}
---
but code is invalid anyway. I suspect that the intention was more
*(cast(T*) &store) = value;
which CTFE cant do anyway.
Comment #3 by b2.temp — 2023-10-05T13:30:08Z
my last comment is wrong, the problem is that implicit conv from static array to its .ptr is not implemented correctly in the CTFE engine.
The expected error happens when doing the cast explicitly:
```d
struct StoreAny {
ubyte[16] store;
this(T)(T value) {
*(cast(T*) store.ptr) = value;
}
}
struct SomeStruct {}
enum StoreAny someEnum = StoreAny(SomeStruct());
```
> a.d:4:20: Error: reinterpreting cast from `ubyte*` to `SomeStruct*` is not supported in CTFE
Comment #4 by robert.schadek — 2024-12-13T19:02:23Z