[Issue 20716] New: Wrong code/ABI for extern(C++) interface method that returns non-POD

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 1 02:34:43 UTC 2020


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 at puremagic.com
          Reporter: ilyayaroshenko at 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;
}

--


More information about the Digitalmars-d-bugs mailing list