[Issue 15970] New: C++ mangling of templated arg type
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Apr 29 02:13:57 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=15970
Issue ID: 15970
Summary: C++ mangling of templated arg type
Product: D
Version: D2
Hardware: x86
OS: Mac OS X
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: jbc.engelen at gmail.com
C++ mangling is wrong when a function takes an argument of type T (templated)
and when the typeof(T) is a class.
Test case:
```
extern(C++) class Symbol {}
extern(C++) class Symbol2 {}
extern(C++) class A(T) {
void foo_template(T t) {}
void foo_incorrect(Symbol t) {}
void foo_correct(Symbol2 t) {}
}
A!int b_works;
A!Symbol b_incorrect;
```
Then running
> dmd -c cpp.d -ofcpp.o
> nm cpp.o | c++filt
gives the correct mangling for A!int:
A<int>::foo_correct(Symbol2*)
A<int>::foo_template(int)
A<int>::foo_incorrect(Symbol*)
but incorrect mangling for A!Symbol:
A<Symbol*>::foo_correct(Symbol2*)
A<Symbol*>::foo_template(A<Symbol*>) <--- argument type wrong
A<Symbol*>::foo_incorrect(A<Symbol*>) <--- argument type wrong
--
More information about the Digitalmars-d-bugs
mailing list