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(); }
Comment #2 by yebblies — 2014-11-10T13:01:10Z
Comment #3 by github-bugzilla — 2014-11-10T14:45:42Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/69a5745cdb2077936423920cc56c8e5a5934d1d7 Fix Issue 13707 - msvc32 C++ struct return ABI not followed for structs with constructors A constructor should stop a struct from being passed in registers on win32/C++. https://github.com/D-Programming-Language/dmd/commit/452cfcc1f20c505f5844a993c6731839325e5e63 Merge pull request #4124 from yebblies/issue13707 [DDMD] Issue 13707 - msvc32 C++ struct return ABI not followed for structs with constructors
Comment #4 by github-bugzilla — 2015-02-18T03:39:26Z
Commits pushed to 2.067 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/69a5745cdb2077936423920cc56c8e5a5934d1d7 Fix Issue 13707 - msvc32 C++ struct return ABI not followed for structs with constructors https://github.com/D-Programming-Language/dmd/commit/452cfcc1f20c505f5844a993c6731839325e5e63 Merge pull request #4124 from yebblies/issue13707