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.
Comment #1 by schveiguy — 2015-01-04T17:49:45Z
Comment #2 by github-bugzilla — 2015-01-05T15:05:11Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/d60b61437081f3cb1b586af05c1507f1c304753c More proper implementation for parse error on version and debug. Fix issue 13932 -- c++ mangling for template negative int parameter add test case for 13932 https://github.com/D-Programming-Language/dmd/commit/85946f3400b4afdb0a664064c4c79fe3218611bc Fix issue 13932 on Windows as well.
Comment #3 by github-bugzilla — 2015-02-18T03:41:48Z