[Issue 16243] wrong C++ argument passing with empty struct and 6 integers

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jul 7 05:32:11 PDT 2016


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

--- Comment #2 from Martin Nowak <code at dawg.eu> ---
Also fails with a single int argument.

cat > cpp.cc << CODE
#include <stdio.h>
struct S13956
{
};

void check13956(S13956 arg0, int arg1);

void func13956(S13956 arg0, int arg1)
{
    printf("C %d\n", arg1);
    check13956(arg0, arg1);
}
CODE

cat > bug.d << CODE
import core.stdc.stdio;
struct S13956
{
}

extern(C++) void func13956(S13956 arg0, int arg1)
{
    check13956(arg0, arg1);
}

extern(C++) void check13956(S13956 arg0, int arg1)
{
    printf("C %d\n", arg1);
    assert(arg0 == S13956());
    assert(arg1 == 1);
}

void main()
{
    func13956(S13956(), 1);
}
CODE

c++ -m32 -c cpp.cc
dmd -m32 cpp.o -run bug

--


More information about the Digitalmars-d-bugs mailing list