[Issue 15373] New: Segfault when using typeid on extern(C++) class with virtual functions

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Nov 22 00:44:52 PST 2015


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 at puremagic.com
          Reporter: jakobovrum at 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.

--


More information about the Digitalmars-d-bugs mailing list