Bug 15576 – extern(C++, namespace) wrong mangling of variables (Windows)
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-01-18T05:36:00Z
Last change time
2017-01-16T23:24:24Z
Keywords
bootcamp, C++
Assigned to
nobody
Creator
turkeyman
Comments
Comment #0 by turkeyman — 2016-01-18T05:36:42Z
C++:
namespace ep {
struct Instance {};
Instance *s_pInstance = nullptr;
}
D:
extern (C++, ep) {
struct Instance {}
extern __gshared Instance* s_pInstance;
}
C++ mangles: ?s_pInstance@ep@@3PEAUInstance@1@EA
D mangles: ?s_pInstance@ep@@2PEAUInstance@1@EA
Notice there is a '2' where a '3' should be.
Comment #1 by jbc.engelen — 2016-11-02T13:40:01Z
I ran into the same problem.
Simpler reproducer:
D:
extern (C++, ep) extern __gshared int variable;
C++:
namespace ep {
int variable;
}
Comment #2 by jbc.engelen — 2016-11-02T14:00:20Z
Bootcamp hint: start looking at `mangleVariable` in `VisualCPPMangler` in cppmangle.d.