Bug 18888 – extern(C++) template arg/alias arg mangling issue

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2018-05-20T23:56:12Z
Last change time
2018-05-21T09:27:17Z
Keywords
C++, industry
Assigned to
No Owner
Creator
Manu

Comments

Comment #0 by turkeyman — 2018-05-20T23:56:12Z
This C++ code: ------------------------------------------ template <typename T> struct TemplateName { void fun() {} }; template <template<typename> typename blah = TemplateName> struct Str { using I = TemplateName<blah<int>>; }; Str<>::I s; ------------------------------------------ Produces the symbol: ?fun@?$TemplateName@U?$TemplateName@H@@@@QEAAXXZ The equivalent D code makes a mistake with the alias argument: ------------------------------------------ extern (C++) struct TemplateName(T) { void fun(); } extern (C++) struct Str(alias blah = TemplateName) { alias I = TemplateName!(blah!int); } pragma(msg, Str!().I.fun.mangleof); ------------------------------------------ Prints: ?fun@?$TemplateName@U?$blah@H@@@@QEAAXXZ Notice that the name of the alias parameter `blah` ends up in there, rather than the template it is an alias of?
Comment #1 by github-bugzilla — 2018-05-21T09:27:16Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/9e6ba61caf2093e81ae2ab8c2254b6b4db125750 Fix issue 18888 - extern(C++) template arg/alias arg mangling issue https://github.com/dlang/dmd/commit/6714f528191843fa8f37011980971a6e76032d6b Merge pull request #8272 from TurkeyMan/alias_mangle Fix issue 18888 - extern(C++) template arg/alias arg mangling issue merged-on-behalf-of: David Nadlinger <[email protected]>