[Issue 22620] New: mangleof sometimes missing C++ namespace or struct/class
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Dec 22 12:28:36 UTC 2021
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: nobody at puremagic.com
Reporter: tim.dlang at t-online.de
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 at Parent@@CAXPEAUStruct@@@Z
MangleOutsideClass: ?func at Parent@@CAXPEAVStruct at 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.
--
More information about the Digitalmars-d-bugs
mailing list