https://issues.dlang.org/show_bug.cgi?id=17454
Walter Bright <bugzi...@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzi...@digitalmars.com --- Comment #1 from Walter Bright <bugzi...@digitalmars.com> --- Let's start by compiling the D code, and disassembling d_fun() with obj2asm to get: push RBP mov RBP,RSP sub RSP,010h lea RCX,[00h][RIP] sub RSP,020h call _d_newclass add RSP,020h mov -8[RBP],RAX mov RAX,-8[RBP] mov RSP,RBP pop RBP ret So RAX becomes the instance of C, and RAX is returned. Nothing wrong with the D code here. Now looking at the C++ code, it doesn't compile. Adding in the declaration of d_fun() and disassembling: sub RSP,038h lea RCX,020h[RSP] call d_fun add RSP,038h ret which is what one expects. I don't know where to go from here. Since you say there is a misalignment, I suggest disassembling the code with the misalignment in it and seeing if it is on the D side or the C++ side. --