https://issues.dlang.org/show_bug.cgi?id=24577
Issue ID: 24577 Summary: Struct with constructor returned from C++ wrong Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: tim.dl...@t-online.de //////////////// testcpp.cpp ////////////// struct S { int i; S(); S(int i); }; S::S() : i(0) { } S::S(int i) : i(i) { } S f() { S r; r.i = 5; return r; } //////////////// test.d //////////////////// import std.stdio; extern(C++) struct S { int i; this(int i); } extern(C++) S f(); void main() { S s = f(); writeln("test ", s); stdout.flush(); assert(s.i == 5); } //////////////////////////////////////////// The above example can be compiled on Windows with: cl /c testcpp.cpp dmd -g -w -m64 test.d testcpp.obj When running it will print a wrong random number: test S(-246417088) It only fails for DMD on Windows with -m64. It works correctly with -m32mscoff or on Linux or OSX. --