https://issues.dlang.org/show_bug.cgi?id=22620
Issue ID: 22620
Summary: mangleof sometimes missing C++ namespace or
struct/class
Product: D
Version: D2
Hardware: x86_64
OS: Windows
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
extern(C++):
class Child : Parent
{
}
extern(C++, "Namespace") extern(C++, class) struct Struct
{
}
class Parent
{
~this();
//pragma(msg, __traits(getCppNamespaces, Struct));
private static void func(Struct*);
pragma(msg, " MangleInClass: " ~ func.mangleof);
}
pragma(msg, "MangleOutsideClass: " ~ Parent.func.mangleof);
///////////////////////////////////////////////////////////////
The code above prints the mangling of the same member function twice. For
Windows 64 bit the output is:
MangleInClass: ?func@Parent@@CAXPEAUStruct@@@Z
MangleOutsideClass: ?func@Parent@@CAXPEAVStruct@Namespace@@@Z
For Linux the output is:
MangleInClass: _ZN6Parent4funcEP6Struct
MangleOutsideClass: _ZN6Parent4funcEPN9Namespace6StructE
Normally it should print the same mangling inside and outside the class, but
actually the mangling is incomplete inside the class. On both platforms it
misses the namespace and on Windows also ignores extern(C++, class). The
mangling printed outside the class is correct.
If trait getCppNamespaces is used inside the class for Struct, then the
mangling will later also be printed correctly inside the class.
--