[Issue 24101] New: Incorrect mangling for parameter of template member function
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Aug 23 01:25:38 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=24101
Issue ID: 24101
Summary: Incorrect mangling for parameter of template member
function
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: snarwin+bugzilla at gmail.com
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).
--
More information about the Digitalmars-d-bugs
mailing list