January 20, 2020
https://issues.dlang.org/show_bug.cgi?id=20520

          Issue ID: 20520
           Summary: Runtime segfault when taking typeid of a class
                    instanciated within an enum
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: cpicard@purrfect.fr

The following code segfaults at runtime. No warning is displayed during compilation so I assume that the operation should be allowed.

    class C {}

    enum Foo {
        Bar = new C()
    }

    void main() {
        pragma(msg, typeid(Foo.Bar)); // Works fine: typeid(C())
        auto t = typeid(Foo.Bar);     // Segfault here
    }

DMD64 D Compiler v2.090.0, no compilation flag necessary to replicate.

--