Thread overview
[Issue 15608] extern(C++) mangling problem
Jan 26, 2016
Manu
Jan 26, 2016
Manu
Jan 26, 2016
Walter Bright
Jan 26, 2016
Sobirari Muhomori
Jan 28, 2016
Manu
Oct 26, 2017
Walter Bright
Mar 23, 2018
Manu
Jun 10, 2019
Nicholas Wilson
January 26, 2016
https://issues.dlang.org/show_bug.cgi?id=15608

Manu <turkeyman@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |C++
           Severity|enhancement                 |normal

--
January 26, 2016
https://issues.dlang.org/show_bug.cgi?id=15608

--- Comment #1 from Manu <turkeyman@gmail.com> ---
MSVC 2015 - Win64

--
January 26, 2016
https://issues.dlang.org/show_bug.cgi?id=15608

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> ---
I need a complete example, i.e. the example must be standalone. String, Variant and Slice are not defined.

--
January 26, 2016
https://issues.dlang.org/show_bug.cgi?id=15608

--- Comment #3 from Sobirari Muhomori <dfj1esp02@sneakemail.com> ---
Looks like 'U' is virtual, 'Q' is final, '$$CB' is const in Slice<const Variant>.

--
January 28, 2016
https://issues.dlang.org/show_bug.cgi?id=15608

--- Comment #4 from Manu <turkeyman@gmail.com> ---
(In reply to Walter Bright from comment #2)
> I need a complete example, i.e. the example must be standalone. String, Variant and Slice are not defined.

I define them as empty structs when testing.
  extern(C++) struct Slice(T) {}
  extern(C++) struct String {}
  extern(C++) struct Variant {}

--
October 26, 2017
https://issues.dlang.org/show_bug.cgi?id=15608

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |mangling

--
March 23, 2018
https://issues.dlang.org/show_bug.cgi?id=15608

Manu <turkeyman@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |industry

--
June 10, 2019
https://issues.dlang.org/show_bug.cgi?id=15608

Nicholas Wilson <iamthewilsonator@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |iamthewilsonator@hotmail.co
                   |                            |m
         Resolution|---                         |WORKSFORME

--- Comment #5 from Nicholas Wilson <iamthewilsonator@hotmail.com> ---
god bolt MSVC v19.20:
template<typename T>
struct Slice {};
struct String {};
struct Variant {};

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

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

LDC beta:

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);
    pragma(msg, CallMethod.mangleof);
}

  extern(C++) struct Slice(T) {}
  extern(C++) struct String {}
  extern(C++) struct Variant {}

both give

//?CallMethod@Component@@UEAA?AUVariant@@UString@@U?$Slice@$$CBUVariant@@@@@Z

--