Bug 22620 – mangleof sometimes missing C++ namespace or struct/class

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2021-12-22T12:28:36Z
Last change time
2024-12-13T19:20:03Z
Keywords
C++, mangling
Assigned to
No Owner
Creator
Tim
See also
https://issues.dlang.org/show_bug.cgi?id=15431, https://issues.dlang.org/show_bug.cgi?id=21691
Moved to GitHub: dmd#20028 →

Comments

Comment #0 by tim.dlang — 2021-12-22T12:28:36Z
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.
Comment #1 by robert.schadek — 2024-12-13T19:20:03Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20028 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB