https://issues.dlang.org/show_bug.cgi?id=17772
Issue ID: 17772 Summary: Wrong C++ mangled names for templated functions Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: ilyayaroshe...@gmail.com //////////////////// //////////////////// _Z3fooIiEiv (D) vs _ZN5SPACE3fooIiEET_v(C++) _Z4foo2IiEiv(D) vs _Z4foo2IiET_v (C++) //////////////////// //////////////////// ////////////// D DMD64 D Compiler v2.076.0-b1-dirty ``` extern(C++, SPACE) T foo(T)(){ T t; return t;} extern(C++) T foo2(T)(){ T t; return t;} pragma(msg, mangledName!(foo!int)); pragma(msg, mangledName!(foo2!int));``` output: _Z3fooIiEiv _Z4foo2IiEiv ////////////// C++ (clang++ for macos and linux) ``` namespace SPACE { template<class T> T foo() { T t; return t;} int bar(){ return foo<int>(); } } template<class T> T foo2() { T t; return t;} int bar2(){ return foo2<int>(); } ``` clang++ -emit-llvm -S -std=c++14 test_exc.cpp output: ; Function Attrs: nounwind ssp uwtable define linkonce_odr i32 @_ZN5SPACE3fooIiEET_v() #1 { %1 = alloca i32, align 4 %2 = load i32, i32* %1, align 4 ret i32 %2 } ; Function Attrs: nounwind ssp uwtable define linkonce_odr i32 @_Z4foo2IiET_v() #1 { %1 = alloca i32, align 4 %2 = load i32, i32* %1, align 4 ret i32 %2 } --