www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12636] New: extern(C++) class that implements D interface

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

--
Apr 24 2014