extern(C++) template problem

Manu turkeyman at gmail.com
Wed May 23 07:09:40 UTC 2018


C++:
---------------------------------------
class C {};

template <typename T>
void create(T** x);
---------------------------------------

D:
---------------------------------------
extern(C++) class C {}

void create(T)(T* x);
---------------------------------------

Trouble is; in CPP, the template mangles as a C, but in D, the class
mangles as C*... so the mangling doesn't match.

`template<typename Class>` is an unbelievably common occurrence in
C++... but how do we express a signature that mangles correctly in D?
D always mangles `Class` as `Class*`... which changes the signature.

>_<


More information about the Digitalmars-d mailing list