[Issue 19563] extern(C++) Incorrect ABI passing small struct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 8 01:54:57 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=19563

Sprink <sprink.noreply at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sprink.noreply at gmail.com

--- Comment #1 from Sprink <sprink.noreply at gmail.com> ---
Appears DMD doesn't take into consideration how to pass a struct based on
anything other than the size of the struct. The Itantium ABI passes a pointer
to the object if it has a copy constructor or destructor.

https://github.com/dlang/dmd/blob/v2.084.0/src/dmd/target.d#L688
https://github.com/dlang/dmd/blob/v2.084.0/src/dmd/backend/cod1.d#L4033

Somewhere in that mess of a backend. Good luck!

Either make sure your structs are more than 8 bytes as a workaround, or just
use LDC they tend to have better C++ interactions.

--


More information about the Digitalmars-d-bugs mailing list