www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20716] New: Wrong code/ABI for extern(C++) interface method

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

          Issue ID: 20716
           Summary: Wrong code/ABI for extern(C++) interface method that
                    returns non-POD
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ilyayaroshenko gmail.com

// OS: Linux, macOS

extern(C++, "foo"):

struct S
{
    void* s;
    ~this() {}
    // or this(this) {}
}

interface I
{
    S x();
}

final class C : I
{
    long l = 3;

    S x()
    {
        assert(l == 3); //fails
        return S.init;
    }
}

extern(D)
void main()
{
    auto s = new C().I.x;
}

--
Mar 31