Bug 13707 – msvc32 C++ struct return ABI not followed for structs with constructors
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2014-11-10T12:55:00Z
Last change time
2015-02-18T03:39:26Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
yebblies
Comments
Comment #0 by yebblies — 2014-11-10T12:55:58Z
Comment #1 by yebblies — 2014-11-10T12:57:51Z
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();
}