www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20520] New: Runtime segfault when taking typeid of a class


          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.

Jan 20 2020