Small structs: interfacing with C++ potentially broken

Tim tim.dlang at t-online.de
Mon Dec 20 11:58:03 UTC 2021


On Monday, 20 December 2021 at 10:24:00 UTC, Jan wrote:
> Is this a known issue, or is there a way to instruct DMD to use 
> a specific calling convention for a given type?

This looks like a bug. It seems to work without constructor in 
C++, but still crashes with a constructor in D. It also seems to 
work if a trivial destructor is added in D: ~this(){}

This could be related to POD types in C++. Structs with 
constructor or destructor are probably passed differently, but 
dmd only looks at the destructor.


More information about the Digitalmars-d-learn mailing list