Thread overview
[Issue 20208] extern (C++) copy constructor bad mangling for dmd
Sep 12, 2019
Eduard Staniloiu
Sep 12, 2019
RazvanN
Sep 12, 2019
kinke
Dec 29, 2021
Tim
Dec 17, 2022
Iain Buclaw
September 12, 2019
https://issues.dlang.org/show_bug.cgi?id=20208

--- Comment #1 from Eduard Staniloiu <edi33416@gmail.com> ---
Forgot to mention.

I also tested with gdc-9 and everything works as expected (same result as with
ldc).

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

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305@gmail.com

--- Comment #2 from RazvanN <razvan.nitu1305@gmail.com> ---
It seems that this is the cause of your problems: https://github.com/dlang/dmd/pull/9806

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

kinke <kinke@gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kinke@gmx.net

--- Comment #3 from kinke <kinke@gmx.net> ---
We probably have to emit extern(C++) copy ctors as 2 symbols for non-Windows,
both the C1 ('complete object ctor') and the C2 ('base object constructor')
variant. There's even a third one, C3 ('complete object allocating
constructor'). A similar mess as for the C++ dtors.

The testcase in https://github.com/dlang/dmd/pull/9806 needed the C2 one, so I assumed it would suffice, but it clearly doesn't: https://godbolt.org/z/qD5Tta

--
December 29, 2021
https://issues.dlang.org/show_bug.cgi?id=20208

Tim <tim.dlang@t-online.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=22636

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=20208

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--
August 20
https://issues.dlang.org/show_bug.cgi?id=20208

Paul Backus <snarwin+bugzilla@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |C++
                 CC|                            |snarwin+bugzilla@gmail.com

--- Comment #4 from Paul Backus <snarwin+bugzilla@gmail.com> ---
Someone just ran into this in the community Discord. I was able to reproduce using both DMD 2.104.0 and LDC 1.33.0 as the D compiler, with the following example program:

--- test.d
extern(C++)
struct Test
{
        this(const ref Test other) {}
}
--- main.cpp
struct Test
{
        Test() = default;
        Test(const Test &other);
};

int main()
{
        Test a;
        Test b = a;
        return 0;
}
---

--