[Issue 19666] Compiler executes illegal instruction casting array to struct pointer

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 3 12:38:41 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=19666

--- Comment #2 from Basile-z <b2.temp at gmx.com> ---
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.

--


More information about the Digitalmars-d-bugs mailing list