[Issue 16944] New: extern(C++) with template produces wrong mangleof
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Dec 2 17:53:36 PST 2016
https://issues.dlang.org/show_bug.cgi?id=16944
Issue ID: 16944
Summary: extern(C++) with template produces wrong mangleof
Product: D
Version: D2
Hardware: x86
OS: Linux
Status: NEW
Severity: critical
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: timothee.cour2 at gmail.com
originally reported here:
http://forum.dlang.org/post/mailman.594.1480720320.9448.digitalmars-d-learn@puremagic.com:
Not sure what's the difference bw _Z21test_D20161202T141925IiET_S0_ and
_Z21test_D20161202T141925IiEii but mangleof produces the one that's not in the
library produced:
test.cpp:
```
template<typename T>
T test_D20161202T141925(T a);
template int test_D20161202T141925<int>(int);
```
clang++ -shared -o libtest.so test.cpp
c++filt _Z21test_D20161202T141925IiET_S0_
int test_D20161202T141925<int>(int)
c++filt _Z21test_D20161202T141925IiEii
int test_D20161202T141925<int>(int)
nm libtest.so|grep test_D20161202T141925:
0000000000000ae0 W _Z21test_D20161202T141925IiET_S0_
```
test.d:
```
extern(C++){
void test_D20161202T141743();
T test_D20161202T141925(T)(T a);
}
void test(){
assert(test_D20161202T141925!int.mangleof ==
"_Z21test_D20161202T141925IiEii");
// but I would expect _Z21test_D20161202T141925IiET_S0_ (otherwise,
undefined symbol)
}
```
--
More information about the Digitalmars-d-bugs
mailing list