Thread overview
[Issue 19563] extern(C++) Incorrect ABI passing small struct
Jan 09, 2019
Manu
Feb 08, 2019
Sprink
Mar 04, 2019
Manu
Mar 04, 2019
Manu
Mar 09, 2019
Dlang Bot
Mar 12, 2019
Dlang Bot
Nov 24, 2022
Walter Bright
Nov 24, 2022
Walter Bright
January 09, 2019
https://issues.dlang.org/show_bug.cgi?id=19563

Manu <turkeyman@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |C++, industry, wrong-code

--
February 08, 2019
https://issues.dlang.org/show_bug.cgi?id=19563

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

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

--- Comment #1 from Sprink <sprink.noreply@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.

--
March 04, 2019
https://issues.dlang.org/show_bug.cgi?id=19563

--- Comment #2 from Manu <turkeyman@gmail.com> ---
If anyone knows how to fix this; here's a head-start:

  https://github.com/dlang/dmd/pull/9411

That commits the unit-test which needs to work.

--
March 04, 2019
https://issues.dlang.org/show_bug.cgi?id=19563

--- Comment #3 from Manu <turkeyman@gmail.com> ---
This bug blocks the druntime `std::string` PR.

--
March 09, 2019
https://issues.dlang.org/show_bug.cgi?id=19563

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
@look-at-me created dlang/dmd pull request #9434 "Fix  Issue 19563 Fix extern(C++) Incorrect ABI passing small struct" mentioning this issue:

- Fix  Issue 19563 Fix extern(C++) Incorrect ABI passing small struct

https://github.com/dlang/dmd/pull/9434

--
March 12, 2019
https://issues.dlang.org/show_bug.cgi?id=19563

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #9434 "Fix  Issue 19563 Fix extern(C++) Incorrect ABI passing small struct" was merged into master:

- bb2892490ee0df3f3fda486e8e549fdb4e58e37b by look-at-me:
  Fix Issue 19563 Fix extern(C++) Incorrect ABI passing small struct

https://github.com/dlang/dmd/pull/9434

--
November 24, 2022
https://issues.dlang.org/show_bug.cgi?id=19563

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=23195

--- Comment #6 from Walter Bright <bugzilla@digitalmars.com> ---
This problem appears to have been introduced by https://github.com/dlang/dmd/pull/9434/

--
November 24, 2022
https://issues.dlang.org/show_bug.cgi?id=19563

--- Comment #7 from Walter Bright <bugzilla@digitalmars.com> ---
(In reply to Walter Bright from comment #6)
> This problem appears to have been introduced by https://github.com/dlang/dmd/pull/9434/

I mean it caused https://issues.dlang.org/show_bug.cgi?id=23195

--