www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15373] New: Segfault when using typeid on extern(C++) class

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

          Issue ID: 15373
           Summary: Segfault when using typeid on extern(C++) class with
                    virtual functions
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: jakobovrum gmail.com

----
extern(C++) interface I
{
    void foo();
}

extern(C++) class C : I
{
    override void foo() {}
}

void main()
{
    import std.stdio;
    writeln(typeid(new C)); // segfault
}
----

This seems like it should be statically disallowed. Any type with an
extern(C++) type in its inheritance hierarchy should be disallowed in typeid().
I don't know if extern(C++) classes can implement D interfaces, but it should
at least return null in such cases.

--
Nov 22 2015