www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18896] New: extern(C++) template with class argument mangling


          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 puremagic.com
          Reporter: turkeyman gmail.com

class C {};

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


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!

May 23 2018