[Issue 13707] msvc32 C++ struct return ABI not followed for structs with constructors

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Nov 10 04:57:51 PST 2014


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

--- Comment #1 from yebblies <yebblies at gmail.com> ---

This struct is passed in registers by dmd, while dmc++ (and presumably msvc)
returns it on the stack, causing crash.  Adding a dtor 'fixes' it.

struct Prot
{
    int kind;
    void *pkg;
    extern(D) this(int kind)
    {
        this.kind = kind;
        this.pkg = null;
    }
    // ~this()
    // {
    // }
}

extern(C++) Prot func();

void main()
{
    auto p = func();
}

--


More information about the Digitalmars-d-bugs mailing list