February 11, 2019
https://issues.dlang.org/show_bug.cgi?id=19666

          Issue ID: 19666
           Summary: Compiler executes illegal instruction casting array to
                    struct pointer
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: andy.pj.hanson@gmail.com

```
struct StoreAny {
    enum size_t maxSize = (void*).sizeof;
    enum size_t maxAlign = (void*).alignof;
    align(maxAlign) ubyte[maxSize] store;

    @trusted this(T)(T value) {
        static assert(T.sizeof <= maxSize && T.alignof <= maxAlign);
        *(cast(T*) store) = value;
    }

    @trusted T as(T)() {
        return *(cast(T*) store);
    }
}

struct SomeStruct { int x; }
enum StoreAny someEnum = StoreAny(SomeStruct());

void main() {
}
```

Compiling this code causes the compiler to terminate with SIGILL.
There is no error if I instantiate with a primitive, e.g. `StoreAny(0)`.

--