[Issue 16479] New: Wrong C++ mangling for template
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Sep 9 03:12:28 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=16479
Issue ID: 16479
Summary: Wrong C++ mangling for template
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: brix at brix-verden.dk
testcase_cpp.cpp:
class StructReader
{
public:
template <typename T>
T getDataField(unsigned int offset) const
{
return 0;
}
};
void initializeTemplates()
{
StructReader reader;
reader.getDataField<signed char>(0);
}
testcase.d:
extern(C++) class StructReader
{
public:
byte getDataField(T)(uint offset) const;
}
void main()
{
new StructReader().getDataField!byte(0);
}
g++ -c testcase_cpp.cpp
dmd testcase.d testcase_cpp.o
testcase.o: In function `_Dmain':
testcase.d:(.text._Dmain+0x20): undefined reference to
`StructReader::getDataField<signed char>::getDataField(unsigned int) const'
collect2: error: ld returned 1 exit status
--- errorlevel 1
D mangles as: _ZNK12StructReader12getDataFieldIaE12getDataFieldEj
Expected C++ symbol: _ZNK12StructReader12getDataFieldIaEET_j
--
More information about the Digitalmars-d-bugs
mailing list