Bug 13932 – c++ mangling for template negative int parameter
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Mac OS X
Creation time
2015-01-04T13:52:00Z
Last change time
2015-02-18T03:41:48Z
Keywords
link-failure, pull
Assigned to
nobody
Creator
schveiguy
Comments
Comment #0 by schveiguy — 2015-01-04T13:52:56Z
When linking with C++ code that uses a negative integer as a template parameter, D will fail to link because it outputs e.g. '-1' instead of 'n1' as required by ABI.
Example:
C++:
template <int x> struct S
{
int member;
};
void func(S<-1> s) {}
D:
struct S(int x)
{
int member;
}
extern(C++) void func(S!(-1) s);
void main()
{
func(S!(-1)(0));
}
result:
Undefined symbols for architecture x86_64:
"__Z4func1SILi-1EE", referenced from:
__Dmain in testcpp1.o
I don't know what platforms other than OSX this causes a problem on.
I am working on a pull that fixes this, will post soon.