extern(C++) with template produces wrong mangleof
Timothee Cour via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Dec 2 15:11:18 PST 2016
What's the difference bw _Z21test_D20161202T141925IiET_S0_ and
_Z21test_D20161202T141925IiEii? 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)
}
```
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20161202/5039fa17/attachment.html>
More information about the Digitalmars-d-learn
mailing list