Who says we can't call C++ constructors?

Atila Neves atila.neves at gmail.com
Tue Apr 24 13:38:58 UTC 2018


On Tuesday, 24 April 2018 at 12:27:30 UTC, Uknown wrote:
> On Tuesday, 24 April 2018 at 11:19:59 UTC, Atila Neves wrote:
>> On Monday, 23 April 2018 at 20:40:47 UTC, Manu wrote:
>>> On 23 April 2018 at 07:27, Atila Neves via 
>>> Digitalmars-d-announce <digitalmars-d-announce at puremagic.com> 
>>> wrote:
>>>> On Saturday, 21 April 2018 at 18:11:09 UTC, Manu wrote:
>>>>>
>>>>> On 21 April 2018 at 05:41, Atila Neves via 
>>>>> Digitalmars-d-announce 
>>>>> <digitalmars-d-announce at puremagic.com> wrote:
>>>>>>
>>>>>> [...]
>> Sure.
>>
>> I thought about generating D wrappers for everything, but in 
>> TDD fashion I tried slapping a pragma(mangle) on the copy 
>> constructor and things just worked. Odd then that dmd doesn't 
>> try to correctly mangle constructors and destructors since 
>> they're perfectly callable.
>>
>> [...]
>
> This is very cool.

Thanks!

> Is it possible to fix the mangling issues in DMD for Copy 
> constructors and destructors?

Yes. And I'm going to have to (see below).

> It seems like it would be less code for dpp,

Eh, it'd be a tiny change.

> and better C++ interop for D in general.

Well, that's the real issue. There are C++ mangling bugs in the 
dmd frontend, and they need to be fixed because of templates. 
They don't have a mangling until they're instantiated, and I 
can't know that ahead of time where the templates are being 
declared. The easiest way to move forward is to just fix the dmd 
frontend. Unless I come up with some crazy idea. Which I wouldn't 
put past me.

Atila


More information about the Digitalmars-d-announce mailing list