[Issue 18896] New: extern(C++) template with class argument mangling

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 23 07:13:11 UTC 2018


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

          Issue ID: 18896
           Summary: extern(C++) template with class argument mangling
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: turkeyman at gmail.com

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.

We really need to offer a solution here, this is a gaping hole!

--


More information about the Digitalmars-d-bugs mailing list