digitalmars.D.learn - extern(C++) with template produces wrong mangleof
- Timothee Cour via Digitalmars-d-learn (30/30) Dec 02 2016 What's the difference bw _Z21test_D20161202T141925IiET_S0_ and
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) } ```
Dec 02 2016