← Back to index
|
Original Bugzilla link
Bug 17772 – Wrong C++ mangled names for templated functions
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-08-22T05:32:43Z
Last change time
2020-02-21T02:13:15Z
Keywords
betterC, C++, mangling, wrong-code
Assigned to
No Owner
Creator
Илья Ярошенко
See also
https://issues.dlang.org/show_bug.cgi?id=18582
Comments
Comment #0
by ilyayaroshenko — 2017-08-22T05:32:43Z
//////////////////// //////////////////// _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 }
Comment #1
by bugzilla — 2018-02-17T06:37:48Z
Partial fix:
https://github.com/dlang/dmd/pull/7906
Comment #2
by github-bugzilla — 2018-02-28T21:32:32Z
Commits pushed to master at
https://github.com/dlang/dmd
https://github.com/dlang/dmd/commit/5bb9d291f2e544f74340150cea335ac7797dbec7
correct namespace mangling for Issue 17772
https://github.com/dlang/dmd/commit/9bed5b46cef44e5cd4e4ed49046329f582616021
Merge pull request #7906 from WalterBright/fix17772part1 correct namespace mangling for Issue 17772 merged-on-behalf-of: Iain Buclaw <
[email protected]
>
Comment #3
by pro.mathias.lang — 2020-02-21T02:13:15Z
This has been fixed by
https://github.com/dlang/dmd/pull/8455