Bug 24101 – Incorrect C++ mangling for parameter of template member function

Status
NEW
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2023-08-23T01:25:38Z
Last change time
2024-12-13T19:30:35Z
Keywords
C++
Assigned to
No Owner
Creator
Paul Backus
Moved to GitHub: dmd#20325 →

Comments

Comment #0 by snarwin+bugzilla — 2023-08-23T01:25:38Z
Example program: --- test.d extern(C++) struct S { void fun(T)(T t) {} alias fun_int = fun!int; } --- main.cpp struct S { template<typename T> void fun(T t); }; int main() { S s; s.fun<int>(0); return 0; } --- When compiling test.d with DMD 2.104.0 and main.cpp with either gcc or clang, the resulting program fails to link. The cause is inconsistent mangling of the member function S::fun<int>. --- $ nm main.o test.o | grep fun U _ZN1S3funIiEEvT_ 0000000000000000 W _ZN1S3funIiEEvi --- GCC and clang correctly mangle the parameter type of S::fun<int> as `T_` (first template argument), but DMD incorrectly mangles it as `i` (int).
Comment #1 by snarwin+bugzilla — 2023-08-23T01:28:05Z
Also affects LDC 1.33.0.
Comment #2 by robert.schadek — 2024-12-13T19:30:35Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20325 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB