Bug 14086 – Invalid extern C++ name for constructor / destructor

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-01-30T23:26:02Z
Last change time
2018-05-21T07:45:24Z
Keywords
C++
Assigned to
No Owner
Creator
Guillaume Chatelet
See also
https://issues.dlang.org/show_bug.cgi?id=4620

Comments

Comment #0 by chatelet.guillaume — 2015-01-30T23:26:02Z
See the following code : https://github.com/gchatelet/dlang_cpp_std/blob/0ff5abaf035a352dd3b46d5b19b2cd222cedf7a6/cpp_std.d The constructor is mangled as : std::basic_string<char, std::char_traits<char>, std::allocator<char> >::__ctor() But should be defined as : std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string() Same thing for the destructor.
Comment #1 by yebblies — 2015-03-22T04:30:48Z
Constructors and destructors are intentionally not mangled correctly, as they do not match the expected C++ abi in other ways. While this might be made to work in the future it's an intentional limitation and not a bug.
Comment #2 by turkeyman — 2018-05-20T02:43:26Z
I use pragma(mangle) to force the mangle for ctors to link to C++ ctor's just fine... in what way is the ABI incompatible?
Comment #3 by github-bugzilla — 2018-05-21T07:45:24Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/0d9b4b39cb2ac49782a408432e98c308133f7624 Fix issue 14086 - Invalid extern C++ name for constructor and virtual destructor https://github.com/dlang/dmd/commit/da4c5e13a9182aada0d8644606a10324a4ad1cec Merge pull request #8265 from TurkeyMan/ctor_mangle Fix issue 14086 - Invalid extern C++ name for constructor merged-on-behalf-of: Jacob Carlborg <[email protected]>