[Issue 12636] New: extern(C++) class that implements D interface segfaults

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Apr 24 10:36:48 PDT 2014


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

          Issue ID: 12636
           Summary: extern(C++) class that implements D interface
                    segfaults
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Mac OS X
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: schveiguy at yahoo.com

Example:
import std.stdio;

interface D
{
    void foo();
}

extern(C++) class C : D
{
    extern(D) override void foo() { writeln("C foo");}
}

void main()
{
    auto c = new C;
    c.foo(); // works
    D d = c;
    d.foo(); // segfault
}

Note, having IUnknown classes (COM classes) that implement D interfaces work
properly. I think this should work.

--


More information about the Digitalmars-d-bugs mailing list