www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15608] New: extern(C++) mangling problem

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

          Issue ID: 15608
           Summary: extern(C++) mangling problem
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: turkeyman gmail.com

C++:

class IComponent
{
  virtual Variant CallMethod(String method, Slice<const Variant> args) = 0;
};

class Component : public IComponent
{
  Variant CallMethod(String method, Slice<const Variant> args) override final;
};


D:

extern(C++) interface IComponent
{
  Variant CallMethod(String method, Slice!(const(Variant)) args);
}

extern (C++) class Component : IComponent
{
  final override Variant CallMethod(String method, Slice!(const(Variant))
args);
}


I think override + final is messing up the C++ mangling.

C++:
?CallMethod Component ep  UEAA?AUVariant 2 U?$BaseString D 2 U?$Slice $$CBUVariant ep   2  Z
D:  
?CallMethod Component ep  QEAA?AUVariant 2 U?$BaseString D 2 U?$Slice UVariant ep   2  Z

'U' is a 'Q', and C++ has a bonus '$$CB'

--
Jan 25